Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker exec -it adminpls python3 -m flask scheduler-reset ---> fails to run #10

Open
terry-sydaus opened this issue Jul 30, 2024 · 1 comment

Comments

@terry-sydaus
Copy link
Contributor

docker exec -it adminpls python3 -m flask scheduler-reset

The above command produces an error when it gets to the TRUNCATE TABLE sql command, as shown below.

sqlalchemy.exc.ArgumentError: Textual SQL expression 'TRUNCATE TABLE task_scheduler C...' should be explicitly declared as text('TRUNCATE TABLE task_scheduler C...')
@terry-sydaus
Copy link
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant