Skip to content

ENH: #44017

Closed
Closed
ENH:#44017
@rockwayschool

Description

@rockwayschool

This is my first time creating an issue on GitHub. I did not see one like it but if there is, please reference it.

I see a lot of communications about adding upsert features to the to_sql method. I think this is a great idea. I would like to know if there is any possibility of adding functionality to call a stored procedure which takes care of the upsert.

Something like:
df.to_sql('mytable', schema='dbo', con=engine, index=False, method='mytable_upsert', stored_proc=True)

I ask because I want to keep my data in a df to upload but I also would like to handle the upsert issues with a stored procedure for performance reasons.

I am using the pymssql driver.

Yes Matthew, I read #14553 and #29636 before creating this. These are very good efforts and I hope they are adopted. The difference with my request is that I would like to be able to call a stored procedure in the database which would handle inserting or updating rows inside the database itself which is faster than issuing a command in python to insert and then finding it exists and then issuing an update on the row. There are ways to do this, just not with a dataframe using to_sql.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO SQLto_sql, read_sql, read_sql_queryNeeds InfoClarification about behavior needed to assess issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions