Passing sql parameters to copy_export #1673
Closed
karunpoudel-chr
started this conversation in
Ideas
Replies: 1 comment
-
You can use cur.copy_expert(
sql.SQL("COPY (select col1, col2 from test where id between {from} and {to}) TO STDOUT WITH CSV HEADER").format(from=sql.Literal(1), to=sql.Literal(10)),
file,
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Since copy_export and copy_to accepts sql query to export the data, one may want to pass parameters similar to
vars
parameter incursor.execute()
function.e.g.
Beta Was this translation helpful? Give feedback.
All reactions