My problem is I am facing
ProgrammingError: copy_from cannot be used with an asynchronous callback.
while trying to copy_from
without async connection. This must be stated, I am creating connection from a celery task. Can someone give me a clue how sqlalchemy or celery or whatever forces my psycopg2 connection behave like async?
conn = psycopg2.connect(con_string)
conn.async
>>0
cur = conn.cursor()
data = BytesIO()
data.write('\n'.join(['Tom\tJenkins\t37',
'Madonna\t\N\t45',
'Federico\tDi Gregorio\t\N']))
data.seek(0)
curs.copy_from(data, 'test_copy')