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 ClickHouse DDL query syntax (on cluster) #527

Merged
merged 5 commits into from Jul 28, 2022

Conversation

andyrichardson
Copy link
Contributor

@andyrichardson andyrichardson commented Jun 24, 2022

Add support for ClickHouse DDL query syntax (source)

This is an example only on CREATE TABLE statements. If you're happy to go ahead with supporting this, I can add this to all CREATE DROP ALTER and RENAME queries

@andyrichardson andyrichardson changed the title Add support for ON_CLUSTER on CREATE TABLE statement Add support for ClickHouse DDL query syntax (on cluster) Jun 24, 2022
@andyrichardson andyrichardson marked this pull request as ready for review June 24, 2022 16:55
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.

Looks great -- thank you @andyrichardson. I think adding support for other DDL statements sounds like a great idea.

The only possible thing that might be worth considering is to only parse ON CLUSTER when using the generic and ClickHouse dialects

src/ast/mod.rs Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jun 28, 2022

Pull Request Test Coverage Report for Build 2755925293

  • 20 of 25 (80.0%) changed or added relevant lines in 3 files are covered.
  • 741 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.1%) to 89.916%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/mod.rs 3 5 60.0%
src/parser.rs 10 13 76.92%
Files with Coverage Reduction New Missed Lines %
tests/sqlparser_mysql.rs 1 99.8%
tests/sqlparser_postgres.rs 8 97.82%
src/ast/query.rs 17 86.61%
tests/sqlparser_common.rs 67 97.21%
src/tokenizer.rs 72 89.27%
src/ast/mod.rs 205 78.75%
src/parser.rs 371 83.37%
Totals Coverage Status
Change from base Build 2535757386: 0.1%
Covered Lines: 9015
Relevant Lines: 10026

💛 - Coveralls

andyrichardson and others added 2 commits July 26, 2022 12:00
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
src/tokenizer.rs Outdated Show resolved Hide resolved
@alamb alamb merged commit 16af309 into sqlparser-rs:main Jul 28, 2022
@andyrichardson andyrichardson deleted the add-on-cluster-support branch August 1, 2022 14:35
mobuchowski pushed a commit to mobuchowski/sqlparser-rs that referenced this pull request Aug 3, 2022
…-rs#527)

* Add on_cluster to Statement::CreateTable

* Add printing of on_cluster

* Update src/ast/mod.rs

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

* Fix fmt + nostd

* Remove unintended diff

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
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