Skip to content

Commit

Permalink
Merge pull request xnuinside#217 from xnuinside/0.31.2_release
Browse files Browse the repository at this point in the history
add encoding to 'read from file' function
  • Loading branch information
xnuinside authored Dec 16, 2023
2 parents ef6b40b + 4c1be44 commit 8eacab7
Show file tree
Hide file tree
Showing 6 changed files with 1,076 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#### Snowflake update:
1. Added support for Snowflake AUTOINCREMENT | IDENTITY column definitions with optional parameter `ORDER|NOORDER` statement - https://github.com/xnuinside/simple-ddl-parser/issues/213

#### Common
1. Added param 'encoding' to parse_from_file function - https://github.com/xnuinside/simple-ddl-parser/issues/142.
Default encoding is utf-8.


**v0.31.1**
### Improvements
#### Snowflake update:
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,17 @@ https://github.com/PBalsdon


## Changelog

**v0.31.2**
### Improvements
#### Snowflake update:
1. Added support for Snowflake AUTOINCREMENT | IDENTITY column definitions with optional parameter `ORDER|NOORDER` statement - https://github.com/xnuinside/simple-ddl-parser/issues/213

#### Common
1. Added param 'encoding' to parse_from_file function - https://github.com/xnuinside/simple-ddl-parser/issues/142.
Default encoding is utf-8.


**v0.31.1**
### Improvements
#### Snowflake update:
Expand Down
18 changes: 18 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,24 @@ https://github.com/PBalsdon
Changelog
---------

**v0.31.2**

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

Snowflake update:
~~~~~~~~~~~~~~~~~


#. Added support for Snowflake AUTOINCREMENT | IDENTITY column definitions with optional parameter ``ORDER|NOORDER`` statement - https://github.com/xnuinside/simple-ddl-parser/issues/213

Common
~~~~~~


#. Added param 'encoding' to parse_from_file function - https://github.com/xnuinside/simple-ddl-parser/issues/142.
Default encoding is utf-8.

**v0.31.1**

Improvements
Expand Down
7 changes: 5 additions & 2 deletions simple_ddl_parser/ddl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,13 @@ def p_error(self, p):


def parse_from_file(
file_path: str, parser_settings: Optional[dict] = None, **kwargs
file_path: str,
encoding: Optional[str] = "utf-8",
parser_settings: Optional[dict] = None,
**kwargs,
) -> List[Dict]:
"""get useful data from ddl"""
with open(file_path, "r") as df:
with open(file_path, "r", encoding=encoding) as df:
return DDLParser(df.read(), **(parser_settings or {})).run(
file_path=file_path, **kwargs
)
Loading

0 comments on commit 8eacab7

Please sign in to comment.