'Why does sqlalchemy takes longer time to execute a query than using mysql client?
I have a query like this:
select max(id), min(id) from MY_TABLE where create_date >= '2022-01-01' and create_date < '2022-01-02'
When I use MySQL Workbench to run this SQL, it use about 250 second. But when I use sqlalchemy with python, this query is stuck, I wait for more than 1 hour and it didn't return any result. I think my code is right because other small query can be executed. My code is like:
engine = sqlalchemy.create_engine(url, connect_args={"ssl": ssl_context})
with engine.connect() as connection:
result = connection.execute(sqlalchemy.text(sql))
What should I do? What params should I check?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
