-
-
Save flossypurse/1ade41df991e133aeeb135b3ce08d6cd to your computer and use it in GitHub Desktop.
Example function that inserts users into a database in a batch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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