Skip to content

Commit 0778198

Browse files
committed
release version 1.0.2
1 parent 8536c65 commit 0778198

File tree

6 files changed

+70
-10
lines changed

6 files changed

+70
-10
lines changed

CHANGELOG.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
**v1.0.2**
2-
### Minor Fixes
3-
1. typo on Databricks dialect
4-
2. improve equals symbols support within COMMENT statement.
5-
3. snowflake TAG now available on SCHEMA definitions.
2+
### Improvements
3+
1. Fixed bug with places first table property value in 'authorization' key. Now it is used real property name.
4+
2. Fixed typo on Databricks dialect
5+
3. improved equals symbols support within COMMENT statement.
66
4. turn regexp into functions
77

8+
### MySQL Improvements
9+
1. UNSIGNED property after int parsed validly now
10+
11+
### Snowflake
12+
1. Snowflake TAG now available on SCHEMA definitions.
13+
14+
815
**v1.0.1**
916
### Minor Fixes
1017
1. When using `normalize_names=True` do not remove `[]` from types like `decimal(21)[]`.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,20 @@ for help with debugging & testing support for BigQuery dialect DDLs:
486486

487487

488488
## Changelog
489+
**v1.1.0**
490+
### Improvements
491+
1. Fixed bug with places first table property value in 'authorization' key. Now it is used real property name.
492+
2. Fixed typo on Databricks dialect
493+
3. improved equals symbols support within COMMENT statement.
494+
4. turn regexp into functions
495+
496+
### MySQL Improvements
497+
1. UNSIGNED property after int parsed validly now
498+
499+
### Snowflake
500+
1. Snowflake TAG now available on SCHEMA definitions.
501+
502+
489503
**v1.0.1**
490504
### Minor Fixes
491505
1. When using `normalize_names=True` do not remove `[]` from types like `decimal(21)[]`.

docs/README.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,29 @@ for help with debugging & testing support for BigQuery dialect DDLs:
549549
Changelog
550550
---------
551551

552+
**v1.1.0**
553+
554+
Improvements
555+
^^^^^^^^^^^^
556+
557+
558+
#. Fixed bug with places first table property value in 'authorization' key. Now it is used real property name.
559+
#. Fixed typo on Databricks dialect
560+
#. improved equals symbols support within COMMENT statement.
561+
#. turn regexp into functions
562+
563+
MySQL Improvements
564+
^^^^^^^^^^^^^^^^^^
565+
566+
567+
#. UNSIGNED property after int parsed validly now
568+
569+
Snowflake
570+
^^^^^^^^^
571+
572+
573+
#. Snowflake TAG now available on SCHEMA definitions.
574+
552575
**v1.0.1**
553576

554577
Minor Fixes

simple_ddl_parser/dialects/sql.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def parse_complex_type(p_list: List[str]) -> str:
177177
if isinstance(p_list[1], dict):
178178
_type = p_list[1]["type"]
179179
start_index = 2
180+
180181
for elem in p_list[start_index:]:
181182
if isinstance(elem, list):
182183
for _elem in elem:
@@ -202,7 +203,6 @@ def p_c_type(self, p: List) -> None:
202203
p[0] = {}
203204
p_list = remove_par(list(p))
204205
_type = None
205-
206206
if len(p_list) == 2:
207207
_type = p_list[-1]
208208
elif isinstance(p[1], str) and p[1].lower() == "encode":
@@ -302,7 +302,11 @@ def process_type_to_column_data(self, p_list, p):
302302
p[0][key] = value
303303
else:
304304
# for [] arrays
305-
p[0]["type"] += p_list[-1]["type"]
305+
if "[]" in p_list[-1]["type"]:
306+
p[0]["type"] += p_list[-1]["type"]
307+
else:
308+
# types like int UNSIGNED
309+
p[0]["type"] += f' {p_list[-1]["type"]}'
306310
del p_list[-1]
307311
return False
308312

@@ -483,7 +487,13 @@ def p_expression_schema(self, p: List) -> None:
483487
if isinstance(p_list[-1], dict):
484488
p[0].update(p_list[-1])
485489
elif len(p) > 2:
486-
p[0]["authorization"] = p[2]
490+
if p[0].get("schema") is not None:
491+
# then is is a authorization schema property
492+
p[0]["authorization"] = p[2]
493+
else:
494+
if isinstance(p_list[-2], dict):
495+
last_key = list(p_list[-2].keys())[-1]
496+
p[0][last_key] = p_list[-1]
487497

488498
def set_properties_for_schema_and_database(self, p: List, p_list: List) -> None:
489499
if not p[0].get("properties"):

tests/test_read_from_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def test_parse_from_file_encoding():
213213
"columns": [
214214
{
215215
"name": "`entry`",
216-
"type": "mediumintunsigned",
216+
"type": "mediumint unsigned",
217217
"size": 8,
218218
"references": None,
219219
"unique": False,

tests/test_references.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ def test_foreigen_keys():
463463
"unique": False,
464464
},
465465
],
466-
"table_properties": {"engine":"InnoDB", "character": "SET","authorization":"utf8"},
466+
"table_properties": {
467+
"engine": "InnoDB",
468+
"character": "utf8",
469+
},
467470
"index": [],
468471
"partitioned_by": [],
469472
"primary_key": ["exception_id"],
@@ -565,7 +568,10 @@ def test_compound_foreigen_keys():
565568
]
566569
},
567570
"tablespace": None,
568-
"table_properties": {"engine":"InnoDB", "character": "SET","authorization":"utf8"},
571+
"table_properties": {
572+
"engine": "InnoDB",
573+
"character": "utf8",
574+
},
569575
}
570576
],
571577
"types": [],

0 commit comments

Comments
 (0)