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 8ca9054
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions geopetl/postgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,11 +602,10 @@ 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)

elif self.db.is_postgis_enabled:
# this query should work for both postgis mview and table
# Could be an odd situation where we have a non-registered table, but the table still has postgis geometry.
elif 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)
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)

# if we find shape fields in target tables/view/materialized vies
Expand Down

0 comments on commit 8ca9054

Please sign in to comment.