Skip to content

Instantly share code, notes, and snippets.

@flossypurse
Created January 31, 2025 23:34
Show Gist options
  • Select an option

  • Save flossypurse/1ade41df991e133aeeb135b3ce08d6cd to your computer and use it in GitHub Desktop.

Select an option

Save flossypurse/1ade41df991e133aeeb135b3ce08d6cd to your computer and use it in GitHub Desktop.
Example function that inserts users into a database in a batch
def _create_users_in_batch(users: list[int]):
for user in users:
conn.execute("INSERT INTO users (value) VALUES (?)", (user,))
conn.commit()
print(f"{len(users)} users have been inserted to database.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment