def run_sql_multiprocessing(args):
the_sql = args[0]
settings = args[1]
pg_conn = psycopg2.connect(settings['pg_connect_string'])
pg_conn.autocommit = True
pg_cur = pg_conn.cursor()
# # set raw gnaf database schema (it's needed for the primary and foreign key creation)
# if settings['raw_gnaf_schema'] != "public":
# pg_cur.execute("SET search_path = {0}, public, pg_catalog".format(settings['raw_gnaf_schema'],))
try:
pg_cur.execute(the_sql)
result = "SUCCESS"
except Exception as ex:
result = "SQL FAILED! : {0} : {1}".format(the_sql, ex)
pg_cur.close()
pg_conn.close()
return result
评论列表
文章目录