Commit 932f98d5 authored by ARCHER's avatar ARCHER 💬

if schema is None, get default schema from

inspect(con).default_schema_name
parent ea5deede
......@@ -4,7 +4,7 @@ import shapely as shp
import shapely.geometry as shpg
from sqlalchemy.orm import sessionmaker
from sqlalchemy.dialects import postgresql
from sqlalchemy import text, MetaData;
from sqlalchemy import text, MetaData, inspect;
from geoalchemy2 import select
import csv
......@@ -126,6 +126,13 @@ def to_sql(df,*args,**kwargs):
if 'if_exists' not in kwargs:
kwargs['if_exists'] = 'fail'
if 'schema' not in kwargs:
kwargs['schema'] = None
if kwargs['schema'] is None:
kwargs['schema'] = inspect(con).default_schema_name
metadata = MetaData(con,reflect=True)
......
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