Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How should I extract nested list for saving to database?

Exception:

Unpack operation not allowed in this context

My code for doing it:

def save_data_to_database(self):
    parsed_records = self.parse_sheet_data()
    for record in parsed_records:
        self.db.set_item(
            "sheet", #table name
            "id, number_of_order, cost, delivery_time" # These are fields in table
            f"{*record}" # Here I'm trying to unpack values, but I can't
        )

Value of ‘parsed_records’ looks like:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

[['1', '1249708', '675', '24.05.2022'], ['2', '1182407', '214', '13.05.2022'], ['3', ...]]

If you see code in above, I want to unpack record with " * " but I can’t.
What should I do for saving records to db?

>Solution :

See if this solve your problem

“,”.join(record)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading