python - psycopg2 error: DatabaseError: error with no message from the libpq -
i have application parses , loads data csv files postgres 9.3 database. in serial execution insert statements/cursor executions work without issue.
i added celery in mix add parallel parsing , inserting of data files. parsing works fine. however, go run insert statements , get:
[2015-05-13 11:30:16,464: error/worker-1] ingest_task.work_it: exception traceback (most recent call last): file "ingest_tasks.py", line 86, in work_it rowcount = ingest_data.load_data(con=con, statements=statements) file "ingest_data.py", line 134, in load_data ingest_curs.execute(statement) databaseerror: error no message libpq
i encountered similar problem when multiprocessing engine.execute(). solved problem adding engine.dispose() right in first line under function subprocess supposed enter, suggested in official document:
when program uses multiprocessing or
fork(), ,engineobject copied child process,engine.dispose()should called engine creates brand new database connections local fork. database connections not travel across process boundaries.
Comments
Post a Comment