From d32ca2342c227fa43dd753fa1661ba0f1928ecf8 Mon Sep 17 00:00:00 2001 From: jzsmoreno <42299052+jzsmoreno@users.noreply.github.com> Date: Thu, 26 Oct 2023 20:04:14 -0600 Subject: [PATCH] Update `schema_config.py` * Add `preserve_order` var --- merge_by_lev/schema_config.py | 9 ++++++++- setup.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/merge_by_lev/schema_config.py b/merge_by_lev/schema_config.py index ef7b0ba..451d187 100644 --- a/merge_by_lev/schema_config.py +++ b/merge_by_lev/schema_config.py @@ -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( @@ -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: @@ -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) diff --git a/setup.py b/setup.py index b892ebe..84455d3 100644 --- a/setup.py +++ b/setup.py @@ -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="jzs.gm27@gmail.com", description="Testing installation of Package",