Commit 8ab59f87 authored by ARCHER's avatar ARCHER

random sql temp table for concurrent access

parent 1403020b
......@@ -7,7 +7,8 @@ from sqlalchemy.dialects import postgresql
from sqlalchemy import text, MetaData, inspect#, Table
from geoalchemy2 import select, Table
from sqlalchemy.sql import except_all
import string
import random
import csv
from io import StringIO
import pandas as pd
......@@ -184,7 +185,7 @@ def to_sql(df,*args,**kwargs):
# create a *fake* temporary table like destination table, but empty
# we can't create a real temporary table because they are not visible to to_sql_legacy
# so we will have to drop it
tmp_table = "_%s" % table
tmp_table = "_to_postgis_tmp__%s_%s" % (''.join(random.choice(string.ascii_letters) for i in range(5)), table )
con.execute("""
DROP TABLE IF EXISTS "%s";
CREATE TABLE "%s" (
......
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