Skip to content

Commit

Permalink
raise DuneError if insert failed
Browse files Browse the repository at this point in the history
  • Loading branch information
couralex6 committed May 24, 2024
1 parent 02712d5 commit 886b796
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
9 changes: 5 additions & 4 deletions dune_client/api/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ def insert_table(
headers={"Content-Type": content_type},
data=data,
)
if "error" in result_json:
return InsertTableErrorResult.from_dict(result_json)
else:
return InsertTableResult.from_dict(result_json)

# return InsertTableErrorResult.from_dict(result_json)
try:
return InsertTableResult.from_dict(result_json)
except KeyError as err:
raise DuneError(result_json, "ResultsResponse", err) from err

def delete_table(self, namespace: str, table_name: str) -> DeleteTableResult:
"""
Expand Down
8 changes: 0 additions & 8 deletions dune_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,6 @@ class InsertTableResult(DataClassJsonMixin):
rows_written: int
bytes_written: int

@dataclass
class InsertTableErrorResult(DataClassJsonMixin):
"""
Data type returned by table/insert operation error
"""

error: str


@dataclass
class DeleteTableResult(DataClassJsonMixin):
Expand Down

0 comments on commit 886b796

Please sign in to comment.