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

Support "Raw" queries to support things like VACUUM #182

Open
keeganmccallum opened this issue Jun 25, 2019 · 3 comments
Open

Support "Raw" queries to support things like VACUUM #182

keeganmccallum opened this issue Jun 25, 2019 · 3 comments

Comments

@keeganmccallum
Copy link

I've found one use case that was a bit difficult, which is using records to perform routine maintenance. I was able to work around with the following code(sql is a records db):

from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
...

vac_conn = sql._engine.raw_connection()
vac_conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
vac_curr = vac_conn.cursor()
vac_curr.execute("VACUUM (ANALYZE)")
vac_conn.close()

It would be great to add a raw flag to the query method, or even just have a raw method to be able to call sql outside of transaction blocks.

@kennethreitz
Copy link
Owner

interesting

@kennethreitz
Copy link
Owner

I will fix this.

@kennethreitz
Copy link
Owner

-raw flag is Perfect!!

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

2 participants