Skip to content
Merged
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
12 changes: 10 additions & 2 deletions servc/svc/com/storage/iceberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ def _connect(self):
return None

tableName = self._get_table_name()
doesExist = self._catalog.table_exists(tableName)
try:
# fix: hack error on rest api, unexplainable
# requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
doesExist = self._catalog.table_exists(tableName)
except:
doesExist = False
if doesExist:
self._ice = self._catalog.load_table(tableName)

elif not doesExist and isinstance(self._table, str):
raise Exception(f"Table {tableName} does not exist")
else:
Expand All @@ -64,7 +70,9 @@ def _connect(self):
partitionSpec: PartitionSpec = PartitionSpec(*partitions)

self._catalog.create_namespace_if_not_exists(self._database)
self._ice = self._catalog.create_table(

# TODO: undo this garbage when rest catalog works
self._ice = self._catalog.create_table_if_not_exists(
tableName,
self._table["schema"],
partition_spec=partitionSpec,
Expand Down
Loading