I am inserting data into a Microsoft Access database using the following code:
test_data.to_sql('employee_table', cnxn, index=False, if_exists='append', chunksize=10, method='multi')
This gives error:
AttributeError: 'CompileError' object has no attribute 'orig'
There is no error when just using the following i.e. no method option:
test_data.to_sql('employee_table', cnxn, index=False, if_exists='append', chunksize=10)
The error message you cited is a subsequent exception caused by the original error (earlier in the stack trace):
The
method="multi"option of.to_sql()wants to create multi-row INSERT statements, often in the form of a "table-value constructor", e.g.,and Access SQL does not support those.
If a plain
.to_sql()(withoutmethod=) is too slow for a large DataFrame then consider the alternative approach documented in the wiki:https://github.com/gordthompson/sqlalchemy-access/wiki/%5Bpandas%5D-faster-alternative-to-.to_sql()-for-large-uploads