Skip to content

Commit 23c35e1

Browse files
committed
fix(sqlalchemy): handle generic geography/geometry by name instead of geotype
1 parent c698d35 commit 23c35e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ibis/backends/base/sql/alchemy/datatypes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def sa_json(_, satype, nullable=True):
296296

297297
@dt.dtype.register(Dialect, (ga.Geometry, ga.types._GISType))
298298
def ga_geometry(_, gatype, nullable=True):
299-
t = gatype.geometry_type
299+
t = gatype.geometry_type.upper()
300300
if t == 'POINT':
301301
return dt.Point(nullable=nullable)
302302
if t == 'LINESTRING':
@@ -309,8 +309,8 @@ def ga_geometry(_, gatype, nullable=True):
309309
return dt.MultiPoint(nullable=nullable)
310310
if t == 'MULTIPOLYGON':
311311
return dt.MultiPolygon(nullable=nullable)
312-
if t == 'GEOMETRY':
313-
return dt.Geometry(nullable=nullable)
312+
if t in ('GEOMETRY', 'GEOGRAPHY'):
313+
return getattr(dt, gatype.name.lower())(nullable=nullable)
314314
else:
315315
raise ValueError(f"Unrecognized geometry type: {t}")
316316

0 commit comments

Comments
 (0)