-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
ENH: Adding hint to to_sql #62799
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
base: main
Are you sure you want to change the base?
ENH: Adding hint to to_sql #62799
Conversation
|
Pyodide CI job failures seem to be unrelated to the code changes made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request. Since the parameter is highly specific to Oracle databases, I am a little hesitant to add a new keyword since to_sql should be general to all databases.
@mroeschke I tried to make the implementation as general as possible for as many different databases that support hints. Would you suggest for now to create a new function users could use specifically for oracle databases? |
|
@mpak123 does SQLAlchemy offer any built-in functionality to handle this? We do try to keep our implementation very "database agnostic," instead deferring to third party libraries that specialize further into the database world. |
This PR adds a new hints parameter to DataFrame.to_sql() and Series.to_sql() that allows users to pass database-specific query hints to optimize INSERT performance. The parameter accepts a dictionary mapping dialect names (e.g., 'oracle', 'mysql', 'postgresql') to complete hint strings (e.g., {'oracle': '/*+ APPEND PARALLEL(4) */', 'mysql': 'DELAYED'}). Users have full control over hint formatting as pandas passes the strings as-is without modification. SQLite raises a UserWarning since hints aren't supported, and ADBC connections raise NotImplementedError. Includes comprehensive tests and documentation updates.
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.