Skip to content

Commit

Permalink
Update schema_config.py
Browse files Browse the repository at this point in the history
* Add `pyarrow.lib.ArrowInvalid` exception
  • Loading branch information
jzsmoreno committed Oct 31, 2023
1 parent d32ca23 commit 3550ef2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions merge_by_lev/schema_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import json

import pyarrow
import pyarrow as pa
import yaml
from pyarrow import Table
from pydbsmgr.lightest import *
from pydbsmgr.main import *
from pydbsmgr.main import DataFrame
from pydbsmgr.lightest import *
from pydbsmgr.utils.azure_sdk import *
from pyarrow import Table


class StandardColumns:
Expand Down Expand Up @@ -217,7 +218,7 @@ def recursive_correction(df_: DataFrame, input_string: str) -> Table:
try:
data_handler = DataSchema(df_)
return pa.Table.from_pandas(df_, schema=data_handler.get_schema())
except pa.lib.ArrowTypeError as e:
except (pa.lib.ArrowTypeError, pyarrow.lib.ArrowInvalid) as e:
iteration_match = re.search(pattern, (str(e).split(","))[-1])
iteration_column_name = iteration_match.group(1)
if column_name != iteration_column_name:
Expand Down Expand Up @@ -307,7 +308,7 @@ def get_table(self) -> Table:
try:
record_batch = pa.RecordBatch.from_pandas(self.df)
table = pa.Table.from_pandas(self.df)
except pa.lib.ArrowTypeError as e:
except (pa.lib.ArrowTypeError, pyarrow.lib.ArrowInvalid) as e:
warning_type = "UserWarning"
msg = "It was not possible to create the table\n"
msg += "Error: {%s}" % e
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.4",
version="0.2.5",
author="J. A. Moreno-Guerra",
author_email="[email protected]",
description="Testing installation of Package",
Expand Down

0 comments on commit 3550ef2

Please sign in to comment.