AttributeError: 'psycopg2.extensions.cursor' 对象没有属性 'fast_executemany'
to_sql() 太慢了。所以试图解决这个问题。但是当我运行以下代码时,我得到了:-
AttributeError: 'psycopg2.extensions.cursor' 对象没有属性 'fast_executemany'
@event.listens_for(conn, 'before_cursor_execute')
def receive_before_cursor_execute(conn, cursor, statement, params, context, executemany):
if executemany:
cursor.fast_executemany = True
cursor.commit()
Run Code Online (Sandbox Code Playgroud)