Skip to content

Commit

Permalink
Conversion improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
littleK0i committed Sep 24, 2024
1 parent 5661600 commit 1aaae16
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.32.0] - 2024-09-24

- Introduced basic "elapsed timers" for performance debugging. Can be enabled with `--show-timers` CLI parameter.
- Added basic support for `VECTOR` type. It can be used for `TABLE`, but not for `FUNCTION` or `PROCEDURE` due to issues with overloading.
- Converting tables with auto-increment now recognizes `ORDER` and `NOORDER` flags.
- Converting views without newline after `AS` is now possible.

## [0.31.2] - 2024-09-05

- Implemented custom `__eq__` method to check `Grants`. It helps to take into account edge case for `INTEGRATION` object grants not returning specific integration type from `SHOW GRANTS` command.
Expand Down
4 changes: 2 additions & 2 deletions snowddl/converter/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

cluster_by_syntax_re = compile(r"^(\w+)?\((.*)\)$")
collate_type_syntax_re = compile(r"^(.*) COLLATE \'(.*)\'$")
identity_re = compile(r"^IDENTITY START (\d+) INCREMENT (\d+)$")

identity_re = compile(r"^IDENTITY START (\d+) INCREMENT (\d+) (ORDER|NOORDER)$")

class TableConverter(AbstractSchemaObjectConverter):
def get_object_type(self) -> ObjectType:
Expand Down Expand Up @@ -132,6 +131,7 @@ def _get_columns(self, row):
identities[sequence_name] = {
"start": int(i.group(1)),
"interval": int(i.group(2)),
"is_ordered": i.group(3) == "ORDER",
}
elif str(c["default"]).upper().endswith(".NEXTVAL"):
col["default_sequence"] = self._normalise_name_with_prefix(str(c["default"])[:-8])
Expand Down
4 changes: 2 additions & 2 deletions snowddl/converter/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from snowddl.parser.view import view_json_schema


view_text_re = compile(r"^.*\sas\n(.*)$", DOTALL)
view_text_re = compile(r"^.*\sas(\n|\s)+(.*)$", DOTALL)


class ViewConverter(AbstractSchemaObjectConverter):
Expand Down Expand Up @@ -83,7 +83,7 @@ def _get_text_or_include(self, object_path: Path, row: dict):
)

view_ddl = cur.fetchone()["VIEW_DDL"]
view_text = view_text_re.sub(r"\1", view_ddl).strip(" \n\r\t()")
view_text = view_text_re.sub(r"\2", view_ddl).rstrip(";").strip(" \n\r\t()")

# Remove trailing spaces from each line to prevent output formatting issues
# https://github.com/yaml/pyyaml/issues/411
Expand Down
2 changes: 1 addition & 1 deletion snowddl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.31.2"
__version__ = "0.32.0"

0 comments on commit 1aaae16

Please sign in to comment.