Seite 1 von 1

execute several separate SQLAlchemy Core statements simultaneously?

Verfasst: Sonntag 25. September 2022, 09:55
von avtar11
I'm executing a number of separate statements using SQLAlchemy Core. The assertions are unconnected and to different tables. I am unable to utilise the usual table as a result. multiple dictionaries of parameters supplied to insert(). I'm doing it right now:

Code: Alles auswählen

sql_conn.execute(query1)
sql_conn.execute(query2)
Can I run them once rather than having to go back and forth to the database twice? I use Python 2.7.11 and MySQL 5.7.

Re: execute several separate SQLAlchemy Core statements simultaneously?

Verfasst: Sonntag 25. September 2022, 15:32
von sparrow
First of all: Update your Python Version. 2.7 is dead and long after life. Update to a supported Version.

Your code waits for the result from the query execution. It is possible an select statement and you want to use the results in your code. If you don't want sequential processing, you have something like threads or take a look to sqlalchemy's async API.