Skip to content

to_sql return inserted row count or list #23998

Closed
@pmkroeker

Description

@pmkroeker

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)

Problem description

This would allow for more quickly knowing how many rows have been entered from your dataframe

Expected Output

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions