Skip to content

Commit

Permalink
Merge pull request #231 from xnuinside/release_1.0.2
Browse files Browse the repository at this point in the history
release version 1.0.2
  • Loading branch information
xnuinside authored Jan 14, 2024
2 parents 8536c65 + 0778198 commit e2dca89
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 10 deletions.
15 changes: 11 additions & 4 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
**v1.0.2**
### Minor Fixes
1. typo on Databricks dialect
2. improve equals symbols support within COMMENT statement.
3. snowflake TAG now available on SCHEMA definitions.
### Improvements
1. Fixed bug with places first table property value in 'authorization' key. Now it is used real property name.
2. Fixed typo on Databricks dialect
3. improved equals symbols support within COMMENT statement.
4. turn regexp into functions

### MySQL Improvements
1. UNSIGNED property after int parsed validly now

### Snowflake
1. Snowflake TAG now available on SCHEMA definitions.


**v1.0.1**
### Minor Fixes
1. When using `normalize_names=True` do not remove `[]` from types like `decimal(21)[]`.
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,20 @@ for help with debugging & testing support for BigQuery dialect DDLs:


## Changelog
**v1.1.0**
### Improvements
1. Fixed bug with places first table property value in 'authorization' key. Now it is used real property name.
2. Fixed typo on Databricks dialect
3. improved equals symbols support within COMMENT statement.
4. turn regexp into functions

### MySQL Improvements
1. UNSIGNED property after int parsed validly now

### Snowflake
1. Snowflake TAG now available on SCHEMA definitions.


**v1.0.1**
### Minor Fixes
1. When using `normalize_names=True` do not remove `[]` from types like `decimal(21)[]`.
Expand Down
23 changes: 23 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,29 @@ for help with debugging & testing support for BigQuery dialect DDLs:
Changelog
---------

**v1.1.0**

Improvements
^^^^^^^^^^^^


#. Fixed bug with places first table property value in 'authorization' key. Now it is used real property name.
#. Fixed typo on Databricks dialect
#. improved equals symbols support within COMMENT statement.
#. turn regexp into functions

MySQL Improvements
^^^^^^^^^^^^^^^^^^


#. UNSIGNED property after int parsed validly now

Snowflake
^^^^^^^^^


#. Snowflake TAG now available on SCHEMA definitions.

**v1.0.1**

Minor Fixes
Expand Down
16 changes: 13 additions & 3 deletions simple_ddl_parser/dialects/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def parse_complex_type(p_list: List[str]) -> str:
if isinstance(p_list[1], dict):
_type = p_list[1]["type"]
start_index = 2

for elem in p_list[start_index:]:
if isinstance(elem, list):
for _elem in elem:
Expand All @@ -202,7 +203,6 @@ def p_c_type(self, p: List) -> None:
p[0] = {}
p_list = remove_par(list(p))
_type = None

if len(p_list) == 2:
_type = p_list[-1]
elif isinstance(p[1], str) and p[1].lower() == "encode":
Expand Down Expand Up @@ -302,7 +302,11 @@ def process_type_to_column_data(self, p_list, p):
p[0][key] = value
else:
# for [] arrays
p[0]["type"] += p_list[-1]["type"]
if "[]" in p_list[-1]["type"]:
p[0]["type"] += p_list[-1]["type"]
else:
# types like int UNSIGNED
p[0]["type"] += f' {p_list[-1]["type"]}'
del p_list[-1]
return False

Expand Down Expand Up @@ -483,7 +487,13 @@ def p_expression_schema(self, p: List) -> None:
if isinstance(p_list[-1], dict):
p[0].update(p_list[-1])
elif len(p) > 2:
p[0]["authorization"] = p[2]
if p[0].get("schema") is not None:
# then is is a authorization schema property
p[0]["authorization"] = p[2]
else:
if isinstance(p_list[-2], dict):
last_key = list(p_list[-2].keys())[-1]
p[0][last_key] = p_list[-1]

def set_properties_for_schema_and_database(self, p: List, p_list: List) -> None:
if not p[0].get("properties"):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_read_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_parse_from_file_encoding():
"columns": [
{
"name": "`entry`",
"type": "mediumintunsigned",
"type": "mediumint unsigned",
"size": 8,
"references": None,
"unique": False,
Expand Down
10 changes: 8 additions & 2 deletions tests/test_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,10 @@ def test_foreigen_keys():
"unique": False,
},
],
"table_properties": {"engine":"InnoDB", "character": "SET","authorization":"utf8"},
"table_properties": {
"engine": "InnoDB",
"character": "utf8",
},
"index": [],
"partitioned_by": [],
"primary_key": ["exception_id"],
Expand Down Expand Up @@ -565,7 +568,10 @@ def test_compound_foreigen_keys():
]
},
"tablespace": None,
"table_properties": {"engine":"InnoDB", "character": "SET","authorization":"utf8"},
"table_properties": {
"engine": "InnoDB",
"character": "utf8",
},
}
],
"types": [],
Expand Down

0 comments on commit e2dca89

Please sign in to comment.