Untitled

mail@pastecode.io avatar
unknown
python
a year ago
236 B
5
Indexable
Never
def insert_records_to_db(records, db_connection):
    for record in records:
        query = f"INSERT INTO users (name, age) VALUES ({record['name']}, {record['age']})"
        db_connection.execute(query)
        db_connection.commit()