-
Notifications
You must be signed in to change notification settings - Fork 157
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
Bulk update values with SQLAlchemy #546
Comments
@fadedcoder hi. you probably mean queries of this type: async def test_bulk(connect):
query = tbl.update().where(
tbl.c.id == sa.bindparam('id')
).values(name=sa.bindparam('name'))
await connect.execute(query, [
dict(id='1', name='test_update1'),
dict(id='2', name='test_update2'),
]) it's impossible. as asynchronous mode does not support |
but isn't there a way to compile many updates/inserts into a single sql query and execute it faster than sequentially execute single queries? It only requires values sanitization and it must be ok. |
@vir-mir is it somehow possible to use According to psycopg/psycopg2#491 (comment):
|
Since aiopg does not support bulk insert (#112), so I use this to insert everything in a single query:
Is there any such thing for bulk updating? Because if I update one by one, it might take quite some time (there are thousands of rows).
The text was updated successfully, but these errors were encountered: