kennethreitz / records

SQL for Humans™
https://pypi.python.org/pypi/records/
ISC License
7.15k stars 570 forks source link

How could I run a SQL background? #124

Closed leafonsword closed 6 years ago

leafonsword commented 6 years ago

I want to run a DDL and a DML, while DDL takes a long time, so I want to put DDL background running, and run DML forground; But belowing code will run DDL and after DDL ends then run DML:

conn.query(f'alter table sbtest3 engine=innodb,algorithm=copy;') 
conn.query(f'insert into sbtest3 values(3);') 
Tethik commented 6 years ago

If I'm understanding this right, you want to run the first statement concurrently with the second statement. Did you try using threading, multiprocessing or an asynchronous library like asyncio?

leafonsword commented 6 years ago

@Tethik Thx, I'm using concurrent.futures now~