Skip to content

Commit

Permalink
fix(sqlalchemy): handle generic geography/geometry by name instead of…
Browse files Browse the repository at this point in the history
… geotype
  • Loading branch information
cpcloud committed Jan 17, 2023
1 parent c698d35 commit 23c35e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ibis/backends/base/sql/alchemy/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def sa_json(_, satype, nullable=True):

@dt.dtype.register(Dialect, (ga.Geometry, ga.types._GISType))
def ga_geometry(_, gatype, nullable=True):
t = gatype.geometry_type
t = gatype.geometry_type.upper()
if t == 'POINT':
return dt.Point(nullable=nullable)
if t == 'LINESTRING':
Expand All @@ -309,8 +309,8 @@ def ga_geometry(_, gatype, nullable=True):
return dt.MultiPoint(nullable=nullable)
if t == 'MULTIPOLYGON':
return dt.MultiPolygon(nullable=nullable)
if t == 'GEOMETRY':
return dt.Geometry(nullable=nullable)
if t in ('GEOMETRY', 'GEOGRAPHY'):
return getattr(dt, gatype.name.lower())(nullable=nullable)
else:
raise ValueError(f"Unrecognized geometry type: {t}")

Expand Down

0 comments on commit 23c35e1

Please sign in to comment.