Potential feature, could df.to_sql()
return the indexes of the inserted rows? Something like knex.js Query Builder
inserted = df.to_sql(con=engine, name=example_table, if_exists='replace', index=False)
This would allow for more quickly knowing how many rows have been entered from your dataframe
Something like inserted = 2
if 2 rows have been added. Even better would be inserted = [24, 25]
where inserted is now a list of the inserted primary keys
Would seem like we could return the sqlalchemy ResultProxy
- answers those type of questions
from sqlalchemy import create_engine
eng = create_engine('sqlite://')
eng.execute("CREATE TABLE data (t TEXT)")
r = eng.execute("INSERT INTO data VALUES ('jane'), ('jon'), ('jack');")
r
# Out[72]: <sqlalchemy.engine.result.ResultProxy at 0x15a83128>
r.rowcount
# Out[73]: 3
Is there any development towards this?
Most helpful comment
Is there any development towards this?