Skip to content

Commit

Permalink
fix(sqlite): handle BLOB datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
ncclementi authored and gforsyth committed Nov 6, 2023
1 parent 96c796f commit d36ed1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions ibis/backends/base/sql/alchemy/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class Unknown(sa.Text):
sat.BOOLEAN: dt.Boolean,
sat.Boolean: dt.Boolean,
sat.BINARY: dt.Binary,
sat.BLOB: dt.Binary,
sat.LargeBinary: dt.Binary,
sat.DATE: dt.Date,
sat.Date: dt.Date,
Expand Down
8 changes: 8 additions & 0 deletions ibis/backends/sqlite/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def db(tmp_path_factory):
con.execute("CREATE TABLE timestamps (ts TIMESTAMP)")
con.execute("CREATE TABLE timestamps_tz (ts TIMESTAMP)")
con.execute("CREATE TABLE weird (str_col STRING, date_col ITSADATE)")
con.execute("CREATE TABLE blobs (data BLOB)")
with con:
con.executemany("INSERT INTO timestamps VALUES (?)", [(t,) for t in TIMESTAMPS])
con.executemany(
Expand All @@ -54,6 +55,7 @@ def db(tmp_path_factory):
("d", "2022-01-04"),
],
)
con.execute("INSERT INTO blobs (data) VALUES (?)", (b"\x00\x01\x02\x03",))
con.close()
return path

Expand Down Expand Up @@ -90,3 +92,9 @@ def test_type_map(db):
}
)
assert res.equals(sol)


def test_read_blob(db):
con = ibis.sqlite.connect(db)
t = con.table("blobs")
assert t["data"].type() == dt.binary

0 comments on commit d36ed1c

Please sign in to comment.