Skip to content

Commit

Permalink
additional check for non-registered postgis tables (courtesy of jrmid…
Browse files Browse the repository at this point in the history
…kiff)
  • Loading branch information
floptical committed Apr 22, 2024
1 parent beb49b9 commit 5ed2db8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions geopetl/postgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,11 @@ def geom_field(self):
stmt = '''select f_geometry_column as column_name from geometry_columns
where f_table_name = '{table_name}' and f_table_schema = '{table_schema}' '''.format(table_name=self.name, table_schema=self.schema)
target_table_shape_fields = self.db.fetch(stmt)
# Could be an odd situation where we have a non-registered table, but the table still has postgis geometry.
if self.db.is_postgis_enabled and not target_table_shape_fields:
stmt = '''select f_geometry_column as column_name from geometry_columns
where f_table_name = '{table_name}' and f_table_schema = '{table_schema}' '''.format(table_name=self.name, table_schema=self.schema)
target_table_shape_fields = self.db.fetch(stmt)

elif self.db.is_postgis_enabled:
# this query should work for both postgis mview and table
Expand Down

0 comments on commit 5ed2db8

Please sign in to comment.