Open terry-sydaus opened 3 months ago
Problem solved.
I added the following import statement:
from sqlalchemy import text
And modified the TRUNCATE TABLE
lines of code, as follows:
t = text("TRUNCATE TABLE task_scheduler CASCADE")
db.session.execute(t)
#db.session.execute('TRUNCATE TABLE task_scheduler CASCADE')
t = text("TRUNCATE TABLE task_list CASCADE")
db.session.execute(t)
#db.session.execute('TRUNCATE TABLE task_list CASCADE')
Where it can be seen that I used the text
method to create a sql variable that could be interpreted by sqlalchemy package.
Happy days!
The above command produces an error when it gets to the TRUNCATE TABLE sql command, as shown below.