Skip to content

Escaping identifiers for safe dynamic SQL in Python for PostgreSQL #2856

Answered by zeroshade
michalc asked this question in Q&A
Discussion options

You must be logged in to vote

ADBC doesn't provide a module for dynamic SQL construction, but anything which can generate the query string could be used with ADBC (just as it could with standard DBAPI functions). In the case of the psycopg sql module you linked to, it appears to have an as_string() method that could generate the full query string which could then be passed to cur.execute(...) with ADBC.

The same would be true for things like sqlglot and so on which can generate the SQL query string for you.

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by michalc
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants