python - How to wait until MySQLdb cursor finish running all queries -


i trying run following code:

with open('file.sql') sqlfile:     sql = sqlfile.read()     cursor.execute(sql) 

file.sql contains sql queries initialize db.

however code finishes working before queries proceed. proceed in few seconds after script finish working.

how can wait until queries proceed?

that's case.

execute() command waits command executed before passing next line of code in script.

that means code won't continue before cursor.execute() finishes execution.

your assumptions wrong. assume you're getting error in sql execution, , that's causes sql skipped.

for one, cursor.execute() can't run multiple sql statements, have split file multiple statements , call cursor.execute() multiple times, 1 each statement.

please remove try/except clauses might hiding errors code above, , provide full error traceback you're getting, if that's not case.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -