Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executemany is slow #44

Open
alixTal opened this issue Mar 14, 2024 · 0 comments
Open

executemany is slow #44

alixTal opened this issue Mar 14, 2024 · 0 comments

Comments

@alixTal
Copy link

alixTal commented Mar 14, 2024

test_data = [
  ('Donna', date(2022, 4, 14)),
  ('Eric', date(2023, 6, 21)),
  ('Kelso', date(2018, 9, 12)),
]
stmt = "INSERT INTO names (first_name, date) VALUES (%s, %s)"
cursor.executemany(stmt, test_data)

When I use executemany it's look like loop through them and insert one by one.

Isn't supposed to turn it to something like this and send at once?

INSERT INTO names (first_name, date)
VALUES ('Donna', '2022-4-14'), ('Eric', '2023-6-21'), ('Kelso', '2018-9-12')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant