Commit bc619374 authored by ARCHER's avatar ARCHER 💬
Browse files

check table exists before try to read column srid

parent b5c823e0
......@@ -126,3 +126,4 @@ dmypy.json
......@@ -81,9 +81,10 @@ def to_postgis(gdf,*args,**kwargs):
if 'if_exists' in kwargs and kwargs['if_exists'] == 'append':
if 'if_exists' in kwargs and kwargs['if_exists'] == 'append' and con1.dialect.has_table(con1, table):
# get actual column srid
column_srid=con1.execute('''SELECT Find_SRID('', '%s', '%s');''' % (table ,[0]
if column_srid != srid:
raise ValueError("geopandas srid %s doesn't match postgis Find_SRID %s" % (srid , column_srid))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment