Skip to content

Commit

Permalink
Update schema_config.py
Browse files Browse the repository at this point in the history
* Add `preserve_order` var
  • Loading branch information
jzsmoreno committed Oct 27, 2023
1 parent 0d8f17c commit d32ca23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion merge_by_lev/schema_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def get_schema(
connection_string: str = "",
container_name: str = "",
overwrite: bool = True,
preserve_order: bool = True,
):
if format_type == "yaml":
return self.create_yaml(
Expand Down Expand Up @@ -290,7 +291,13 @@ def get_schema(
if os.path.exists(schema_file_path):
os.remove(schema_file_path)

if preserve_order:
try:
schema = pa.Schema.from_pandas(self.df)
except:
None
self.schema = schema

return schema

def get_table(self) -> Table:
Expand Down Expand Up @@ -319,7 +326,7 @@ def get_table(self) -> Table:
df = pd.DataFrame(data)
table_name = "test_table"
data_handler = DataSchema(df)
# data_handler.get_schema()
schema = data_handler.get_schema()
table = data_handler.get_table()
column_handler = StandardColumns(df)
df = column_handler.get_frame(write_to_cloud=False)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="merge_by_lev",
version="0.2.3",
version="0.2.4",
author="J. A. Moreno-Guerra",
author_email="[email protected]",
description="Testing installation of Package",
Expand Down

0 comments on commit d32ca23

Please sign in to comment.