Skip to content

Commit

Permalink
chore: catch AttributeError instead of checking
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 26, 2024
1 parent 7c488da commit 2f69cde
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ibis/backends/duckdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1609,10 +1609,15 @@ def _in_memory_table_exists(self, name: str) -> bool:
return True

def _register_in_memory_table(self, op: ops.InMemoryTable) -> None:
if hasattr(op.data, "to_pyarrow_dataset"):
self.con.register(op.name, op.data.to_pyarrow_dataset(op.schema))
else:
self.con.register(op.name, op.data.to_pyarrow(op.schema))
data = op.data
schema = op.schema

try:
obj = data.to_pyarrow_dataset(schema)
except AttributeError:
obj = data.to_pyarrow(schema)

self.con.register(op.name, obj)

def _finalize_memtable(self, name: str) -> None:
# if we don't aggressively unregister tables duckdb will keep a
Expand Down

0 comments on commit 2f69cde

Please sign in to comment.