Skip to content

Commit

Permalink
Merge pull request #28 from JasperHG90/fix/create-table
Browse files Browse the repository at this point in the history
chore: when creating table drop if_exists
  • Loading branch information
JasperHG90 authored Nov 23, 2024
2 parents 51acab1 + cd1860a commit be7fce7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/dagster_pyiceberg/_utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def table_writer(
)
else:
logger.debug("Creating new table")
table = create_table_if_not_exists(
table = create_table(
catalog=catalog,
table_path=table_path,
schema=data.schema,
Expand Down Expand Up @@ -188,7 +188,7 @@ def table_exists(catalog: Catalog, table_path: str) -> bool:
return False


def create_table_if_not_exists(
def create_table(
catalog: Catalog,
table_path: str,
schema: pa.Schema,
Expand All @@ -205,7 +205,7 @@ def create_table_if_not_exists(
Raises:
RetryError: Raised when the commit fails after the maximum number of retries
"""
PyIcebergCreateTableIfNotExistsWithRetry(catalog=catalog).execute(
PyIcebergCreateTableWithRetry(catalog=catalog).execute(
retries=3,
exception_types=(CommitFailedException, TableAlreadyExistsError),
table_path=table_path,
Expand All @@ -215,7 +215,7 @@ def create_table_if_not_exists(
return catalog.load_table(table_path)


class PyIcebergCreateTableIfNotExistsWithRetry(PyIcebergOperationWithRetry):
class PyIcebergCreateTableWithRetry(PyIcebergOperationWithRetry):

def __init__(self, catalog: Catalog):
self.catalog = catalog
Expand All @@ -225,7 +225,7 @@ def refresh(self):
...

def operation(self, table_path: str, schema: pa.Schema, properties: Dict[str, str]):
self.catalog.create_table_if_not_exists(
self.catalog.create_table(
table_path,
schema=schema,
properties=properties,
Expand Down

0 comments on commit be7fce7

Please sign in to comment.