Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add encoding to 'read from file' function #217

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading