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

FORCE QUOTE flag can't be specified in flags #10

Open
svisser opened this issue Feb 20, 2019 · 1 comment
Open

FORCE QUOTE flag can't be specified in flags #10

svisser opened this issue Feb 20, 2019 · 1 comment

Comments

@svisser
Copy link

svisser commented Feb 20, 2019

Example query that I'd like to generate:

COPY (
     select id
     from customers
     limit 1
)
TO STDOUT
WITH CSV HEADER QUOTE AS '"'
FORCE QUOTE id;

However, due to the logic in format_flag() it's not possible to pass force_quote="id" or force_quote=["id"] or force_quote=("id",) when calling copy_to() as it calls repr() in each case on those values.

I'm happy to create a pull request if this project is still being maintained?

Perhaps a solution could be to whitelist certain flag names and treat them differently when formatting?

@svisser
Copy link
Author

svisser commented Feb 21, 2019

Apparently the columns also need to be wrapped with () so it'd need to become:

COPY (
  select id
  from customers
  limit 1
) TO STDOUT (FORMAT 'csv', HEADER TRUE, FORCE_QUOTE (id));

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