sqlExport: Use FROM DUAL
in insertDistinct to fix older mariadb
This commit is contained in:
parent
bdf3b84c74
commit
f84f357056
@ -32,7 +32,7 @@ def insertDistinctFromTableMap(table, data, tableMap):
|
||||
# TODO: this could probably be done better as a single statement?
|
||||
c.executemany(
|
||||
f"""INSERT INTO {table} ({','.join(f'`{k}`' for k in tableMap.keys())})
|
||||
SELECT {','.join(len(tableMap) * ['%s'])}
|
||||
SELECT {','.join(len(tableMap) * ['%s'])} FROM DUAL
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 from {table}
|
||||
WHERE {' AND '.join(f'`{k}`<=>%s' for k in tableMap.keys())}
|
||||
|
Reference in New Issue
Block a user