Skip to content

Commit

Permalink
Merge pull request #274 from dmaresma/fix/issue_273_external_table_fi…
Browse files Browse the repository at this point in the history
…le_format_simple

fix file_format simple name ref only no def
  • Loading branch information
xnuinside authored Aug 1, 2024
2 parents cb4e1b5 + abebd29 commit 2ef4718
Show file tree
Hide file tree
Showing 6 changed files with 566 additions and 54,520 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
**v1.5.2**
### Fixes

1. In Snowflake Fix unexpected behaviour when file_format name given - https://github.com/xnuinside/simple-ddl-parser/issues/273
2.

**v1.5.1**
### Improvements
#### MySQL
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,15 @@ for help with debugging & testing support for BigQuery dialect DDLs:
* https://github.com/ankitdata ,
* https://github.com/kalyan939


## Changelog

**v1.5.2**

### Fixes

1. Fix Snowflake unexpected behaviour when file_format name given - https://github.com/xnuinside/simple-ddl-parser/issues/273
2.

**v1.5.1**
### Improvements
#### MySQL
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "simple-ddl-parser"
version = "1.5.1"
version = "1.5.2"
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."
authors = ["Iuliia Volkova <xnuinside@gmail.com>"]
license = "MIT"
Expand Down
17 changes: 11 additions & 6 deletions simple_ddl_parser/dialects/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,21 @@ def p_multi_id_or_string(self, p: List) -> None:
p[0] = value

def p_fmt_equals(self, p: List) -> None:
"""fmt_equals : id LP multi_id_or_string RP"""
"""fmt_equals : id LP multi_id_or_string RP
| id id_or_string
"""
fmt_split = re.compile(
r"\w+\s*=\s*\w+|\w+\s*=\s*'.'|\w+\s*=\s*'..'|\w+\s*=\s*\('.+'\)|\w+\s*=\(\)"
)
p_list = list(p)
p[0] = {
f.split("=")[0].strip(): f.split("=")[1].strip()
for f in fmt_split.findall(p_list[3])
if "=" in f
}
if len(p_list) > 3:
p[0] = {
f.split("=")[0].strip(): f.split("=")[1].strip()
for f in fmt_split.findall(p_list[3])
if "=" in f
}
else:
p[0] = str(p_list[-1])

def p_table_property_equals(self, p: List) -> None:
"""table_property_equals : id id id_or_string
Expand Down
Loading

0 comments on commit 2ef4718

Please sign in to comment.