Skip to content

ENH: #44017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rockwayschool opened this issue Oct 13, 2021 · 3 comments
Closed

ENH: #44017

rockwayschool opened this issue Oct 13, 2021 · 3 comments
Labels
Enhancement IO SQL to_sql, read_sql, read_sql_query Needs Info Clarification about behavior needed to assess issue

Comments

@rockwayschool
Copy link

rockwayschool commented Oct 13, 2021

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.

@rockwayschool rockwayschool added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 13, 2021
@mzeitlin11
Copy link
Member

Thanks for the request @rockwayschool. It would helpful if you can fill in the enhancement form and answer the questions it asks (especially providing a clear, minimal example of why this is useful).

Also please read through the upsert discussions in #14553 and #29636 - is this request asking for something different?

@mzeitlin11 mzeitlin11 added IO SQL to_sql, read_sql, read_sql_query Needs Info Clarification about behavior needed to assess issue and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 13, 2021
@jbrockmendel
Copy link
Member

Pls add an informative title to the issue

@mzeitlin11
Copy link
Member

Closing for now, happen to reopen if you can respond to comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO SQL to_sql, read_sql, read_sql_query Needs Info Clarification about behavior needed to assess issue
Projects
None yet
Development

No branches or pull requests

3 participants