Skip to content

Commit f7d9162

Browse files
committed
fix: improve error handling and streamline capsule registration process
1 parent 4052661 commit f7d9162

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

examples/raw_capsule_registration_failure.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ def main() -> None:
3636
"""Attempt to use the capsule the same way existing callers do."""
3737

3838
ctx = SessionContext()
39-
capsule = make_table_provider_capsule()
40-
4139
try:
42-
Table(capsule)
43-
except ValueError as err:
44-
print("Constructing Table(capsule) failed:", err)
40+
capsule = make_table_provider_capsule()
41+
except Exception as err:
42+
print("Creating the PyCapsule failed:", err)
43+
return
4544

4645
try:
47-
ctx.register_table("capsule", capsule)
46+
ctx.read_table(capsule)
4847
except ValueError as err:
4948
print("Registering capsule with SessionContext failed:", err)
5049

examples/table_capsule_failure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
from datafusion import SessionContext, Table, udtf
1414

15-
1615
def main() -> None:
1716
"""Register a Python table UDTF that returns a ``Table`` and trigger it."""
1817

0 commit comments

Comments
 (0)