-
-
Notifications
You must be signed in to change notification settings - Fork 821
fix(clickhouse): add support for DateTime64(precision, tz) and Tuples() #6060
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
fix(clickhouse): add support for DateTime64(precision, tz) and Tuples() #6060
Conversation
Coverage Results ✅
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing this!
Changes look mostly good. Thanks for following the same pattern used in the bigquery dialect.
One thing which isn't critical, but would be nice is whether we can get DateTime64
to parse as a data_type_identifier
rather than a keyword
in the test cases 🤔 . That way they'll get handled appropriately by the capitalisation rules.
I think the best way to achieve that would be instead of just "DATETIME64"
, you use the slightly longer StringParser("DATETIME64", DatatypeIdentifierSegment)
. It's a big more verbose but I think it's more robust on how things get treated in the rules.
You've also got some linting issues in the CI suite, but they should be fairly easy to resolve.
@alanmcruickshank it should be good to go, I fixed the last violations of the pre-commit. Thank you for your time and review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
Thanks for your contribution, and especially for taking the time to make the edits.
Brief summary of the change made
The changes introduce support on the Clickhouse dialect for types and type casts related to
DateTime64
andTuple
(structs in clickhouse), the following syntaxes were unparseable using sqlfluff 3.1.0 (and dbt-clickhouse 1.8.1, withsqlfluff-templater-dbt==3.1.0
as example :Are there any other side effects of this change that we should be aware of?
Nope
Pull Request checklist
Please confirm you have completed any of the necessary steps below.
Included test cases to demonstrate any code changes, which may be one or more of the following:
.sql
/.yml
parser test cases intest/fixtures/dialects
(note YML files can be auto generated withtox -e generate-fixture-yml
).