Skip to content

Commit

Permalink
feat(oracle): add support for loading Oracle RAW and BLOB types
Browse files Browse the repository at this point in the history
  • Loading branch information
gforsyth authored and cpcloud committed Oct 17, 2023
1 parent 6d0e125 commit c77eeb2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ibis/backends/oracle/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class OracleType(AlchemyType):
def to_ibis(cls, typ, nullable=True):
if isinstance(typ, oracle.ROWID):
return dt.String(nullable=nullable)
elif isinstance(typ, (oracle.RAW, sat.BLOB)):
return dt.Binary(nullable=nullable)
elif isinstance(typ, sat.Float):
return dt.Float64(nullable=nullable)
elif isinstance(typ, sat.Numeric):
Expand Down
23 changes: 23 additions & 0 deletions ibis/backends/oracle/tests/test_datatypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from __future__ import annotations

import ibis


def test_failed_column_inference(con):
# This is a table in the Docker container that we know fails
# column type inference, so if is loaded, then we're in OK shape.
table = con.table("ALL_DOMAINS", schema="SYS")
assert len(table.columns)


def test_blob_raw(con):
con.drop_table("blob_raw_blobs_blob_raw", force=True)

with con.begin() as bind:
bind.exec_driver_sql(
"""CREATE TABLE "blob_raw_blobs_blob_raw" ("blob" BLOB, "raw" RAW(255))"""
)

raw_blob = con.table("blob_raw_blobs_blob_raw")

assert raw_blob.schema() == ibis.Schema(dict(blob="binary", raw="binary"))

0 comments on commit c77eeb2

Please sign in to comment.