Skip to content

Commit d2413d5

Browse files
authored
Merge branch 'main' into some-refactorings-1
2 parents 2bc0075 + 2ef4718 commit d2413d5

File tree

6 files changed

+566
-54520
lines changed

6 files changed

+566
-54520
lines changed

CHANGELOG.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
**v1.5.2**
2+
### Fixes
3+
4+
1. In Snowflake Fix unexpected behaviour when file_format name given - https://github.com/xnuinside/simple-ddl-parser/issues/273
5+
2.
6+
17
**v1.5.1**
28
### Improvements
39
#### MySQL

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,15 @@ for help with debugging & testing support for BigQuery dialect DDLs:
488488
* https://github.com/ankitdata ,
489489
* https://github.com/kalyan939
490490

491-
492491
## Changelog
492+
493+
**v1.5.2**
494+
495+
### Fixes
496+
497+
1. Fix Snowflake unexpected behaviour when file_format name given - https://github.com/xnuinside/simple-ddl-parser/issues/273
498+
2.
499+
493500
**v1.5.1**
494501
### Improvements
495502
#### MySQL

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "simple-ddl-parser"
3-
version = "1.5.1"
3+
version = "1.5.2"
44
description = "Simple DDL Parser to parse SQL & dialects like HQL, TSQL (MSSQL), Oracle, AWS Redshift, Snowflake, MySQL, PostgreSQL, etc ddl files to json/python dict with full information about columns: types, defaults, primary keys, etc.; sequences, alters, custom types & other entities from ddl."
55
authors = ["Iuliia Volkova <xnuinside@gmail.com>"]
66
license = "MIT"

simple_ddl_parser/dialects/snowflake.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ def p_multi_id_or_string(self, p: List) -> None:
3838
p[0] = value
3939

4040
def p_fmt_equals(self, p: List) -> None:
41-
"""fmt_equals : id LP multi_id_or_string RP"""
41+
"""fmt_equals : id LP multi_id_or_string RP
42+
| id id_or_string
43+
"""
4244
fmt_split = re.compile(
4345
r"\w+\s*=\s*\w+|\w+\s*=\s*'.'|\w+\s*=\s*'..'|\w+\s*=\s*\('.+'\)|\w+\s*=\(\)"
4446
)
4547
p_list = list(p)
46-
p[0] = {
47-
f.split("=")[0].strip(): f.split("=")[1].strip()
48-
for f in fmt_split.findall(p_list[3])
49-
if "=" in f
50-
}
48+
if len(p_list) > 3:
49+
p[0] = {
50+
f.split("=")[0].strip(): f.split("=")[1].strip()
51+
for f in fmt_split.findall(p_list[3])
52+
if "=" in f
53+
}
54+
else:
55+
p[0] = str(p_list[-1])
5156

5257
def p_table_property_equals(self, p: List) -> None:
5358
"""table_property_equals : id id id_or_string

0 commit comments

Comments
 (0)