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

Add support for FROM <filename>, DELIMITER, and CSV HEADER options for COPY command #409

Merged
merged 2 commits into from
Feb 7, 2022

Conversation

poonai
Copy link
Contributor

@poonai poonai commented Feb 3, 2022

This PR adds support for delimiter and csv header options in copy command

Signed-off-by: password rbalajis25@gmail.com

@coveralls
Copy link

coveralls commented Feb 3, 2022

Pull Request Test Coverage Report for Build 1801328813

  • 60 of 67 (89.55%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.09%) to 90.413%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/mod.rs 11 14 78.57%
src/parser.rs 19 23 82.61%
Totals Coverage Status
Change from base Build 1799434596: 0.09%
Covered Lines: 6809
Relevant Lines: 7531

💛 - Coveralls

@alamb alamb changed the title add additional options for copy command Add support for FROM <filename>, DELIMITER, and CSV HEADER options for COPY command Feb 5, 2022
Copy link
Collaborator

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @poonai . I had a question about CSV HEADER

the lint CI failures should be resolved if you merge up to main

filename: Option<Ident>,
/// delimiter character
delimiter: Option<Ident>,
/// CSV HEADER
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think CSV HEADER was part of the syntax. Postgres seems to only support HEADER:

https://www.postgresql.org/docs/13/sql-copy.html

I think CSV is used as part of the FORMAT option, like

COPY ... FORMAT CSV ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compactability

If you scroll down, you'll find the compatibility section. There you can find CSV HEADER spec.

Sure, I merge the main

Signed-off-by: password <rbalajis25@gmail.com>
Signed-off-by: password <rbalajis25@gmail.com>
Copy link
Collaborator

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @poonai for the contribution. If/when people want further support for COPY options, we can always add it as a follow on PR

@alamb alamb merged commit 2614576 into sqlparser-rs:main Feb 7, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants