Skip to content

Conversation

@mpak123
Copy link
Contributor

@mpak123 mpak123 commented Oct 22, 2025

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.

@mpak123
Copy link
Contributor Author

mpak123 commented Oct 23, 2025

Pyodide CI job failures seem to be unrelated to the code changes made.

Copy link
Member

@mroeschke mroeschke left a 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.

@mpak123
Copy link
Contributor Author

mpak123 commented Oct 23, 2025

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Adding hint to to_sql

2 participants