Skip to content

Commit

Permalink
Support create/alter warehouse (#320)
Browse files Browse the repository at this point in the history
* refactor: organize rules into separate files

* refactor: rename FUNCTION ruleset

* feat close #312, #299: support create/alter warehouse

* chore: update primer refs, changelog
  • Loading branch information
tconbeer authored Nov 17, 2022
1 parent 10eccbc commit f349abe
Show file tree
Hide file tree
Showing 18 changed files with 977 additions and 809 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.

- sqlfmt now supports `{% materialization ... %}` and `{% call statement(...) %}` blocks ([#309](https://github.com/tconbeer/sqlfmt/issues/309)).
- sqlfmt now resets the SQL depth of a query after encountering an `{% endmacro %}`, `{% endtest %}`, `{% endcall %}`, or `{% endmaterialization %}` tag.
- sqlfmt now supports `CREATE WAREHOUSE` and `ALTER WAREHOUSE` statements ([#312](https://github.com/tconbeer/sqlfmt/issues/312), [#299](https://github.com/tconbeer/sqlfmt/issues/312))
- fixed a bug where we could have unsafely run *black* against jinja that contained Python keywords and their safe alternatives (e.g., `return(return_())`).

## [0.13.0] - 2022-11-01
Expand Down
5 changes: 1 addition & 4 deletions src/sqlfmt/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
)
from sqlfmt.line import Line
from sqlfmt.node import Node, get_previous_token
from sqlfmt.rule import MAYBE_WHITESPACES, Rule
from sqlfmt.token import Token, TokenType

if TYPE_CHECKING:
from sqlfmt.analyzer import Analyzer
from sqlfmt.rule import Rule


def group(*choices: str) -> str:
Expand All @@ -23,9 +23,6 @@ def group(*choices: str) -> str:
return f"({'|'.join(choices)})"


MAYBE_WHITESPACES: str = r"[^\S\n]*" # any whitespace except newline


def raise_sqlfmt_bracket_error(
_: "Analyzer", source_string: str, match: re.Match
) -> None:
Expand Down
3 changes: 2 additions & 1 deletion src/sqlfmt/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from sqlfmt.analyzer import Analyzer
from sqlfmt.node_manager import NodeManager
from sqlfmt.rule import MAIN, Rule
from sqlfmt.rule import Rule
from sqlfmt.rules import MAIN


class Dialect(ABC):
Expand Down
10 changes: 0 additions & 10 deletions src/sqlfmt/re_utils.py

This file was deleted.

Loading

0 comments on commit f349abe

Please sign in to comment.