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
Postgres: Views and named notations #4073
Conversation
@davetapley could you allow edits from maintainers on your next PR? We need to keep the branch up to date before we can merge. |
Could you also run |
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #4073 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 191 191
Lines 14718 14722 +4
=========================================
+ Hits 14718 14722 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Maybe it worth to mention that it supports the Timescaledb in the dialects supported session? |
@jonatas I'm not sure, since Timescaledb is really just a Postgres extension. Unless it has any of its own syntax? |
Also, most people will just merge in |
@greg-finley whoops, sorry about that. Linters run and rebased. |
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.
Good start! Just a few minor things.
@@ -2029,6 +2043,7 @@ class CreateMaterializedViewStatementSegment(BaseSegment): | |||
|
|||
match_grammar = Sequence( | |||
"CREATE", | |||
Sequence("OR", "REPLACE", optional=True), |
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.
Sequence("OR", "REPLACE", optional=True), | |
Ref("OrReplaceGrammar", optional=True), |
|
||
CREATE OR REPLACE MATERIALIZED VIEW my_mat_view AS | ||
SELECT a | ||
FROM my_table; |
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.
Let's add newlines at end of files. Your IDE probably has a setting.
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 the contribution and for working through the feedback! 🎉
You're right @davetapley ! yeah, Timescaledb doesn't offers any dialect change. I was thinking more on creating specific linters to Timescaledb functions, like when you create a refresh policy with interval smaller than the time_bucket, it would be great to just warn about it, but it would be necessary to have access to the time_bucket used in the view, so, probably worth to make it like a warning inside the function itself. |
Brief summary of the change made
Add support for conventions used by https://github.com/timescale/timescaledb:
Fixes #4072
Fixes #4074
Since I was in there anyway:
Fixes #4069
Are there any other side effects of this change that we should be aware of?
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:
.yml
rule test cases intest/fixtures/rules/std_rule_cases
..sql
/.yml
parser test cases intest/fixtures/dialects
(note YML files can be auto generated withtox -e generate-fixture-yml
).Full autofix test cases intest/fixtures/linter/autofix
.Other.Added appropriate documentation for the change.
Created GitHub issues for any relevant followup/future enhancements if appropriate.