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

feat: support create <object> clone, close #313 #352

Merged
merged 2 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: allow qualified and quoted identifiers in create stmt
  • Loading branch information
tconbeer committed Jan 13, 2023
commit a4f31937e2290c751631f5690ac39034d957fc68
2 changes: 1 addition & 1 deletion src/sqlfmt/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
Rule(
name="create_clone",
priority=2015,
pattern=group(CREATE_CLONABLE + r"\s+\w+\s+clone") + group(r"\W", r"$"),
pattern=group(CREATE_CLONABLE + r"\s+.+?\s+clone") + group(r"\W", r"$"),
action=partial(
actions.handle_nonreserved_keyword,
action=partial(
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/test_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def get_rule(ruleset: List[Rule], rule_name: str) -> Rule:
(WAREHOUSE, "unterm_keyword", "resume if suspended"),
(WAREHOUSE, "unterm_keyword", "unset scaling_policy"),
(MAIN, "create_clone", "create table foo clone"),
(MAIN, "create_clone", "create table db.sch.foo clone"),
(MAIN, "create_clone", "create or replace database foo clone"),
(MAIN, "create_clone", "create stage if not exists foo clone"),
(CLONE, "unterm_keyword", "create table"),
Expand Down