BUG/TST: Fix io.sql.write_frame replace bug and complete test coverage of if_exists functionality by davidshinn · Pull Request #4304 · pandas-dev/pandas (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation9 Commits7 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
This fixes #2971 and #4110. This also provides test coverage for the different values for the if_exists argument for io.sql.write_frame.
The if_exists argument in io.sql.write_frame needed data validation because the logic of the function implicitly used 'append' if the argument value was any string that was not either 'fail' or 'replace'. I added a new unit test to support the requirement.
This refactor results in the function logic being clearer, since if_exists is only relevant when exists is True, the program flow is better served to have if_exists control flow only when exists is True
…1d8d4
sqlite3 convenience function executescript not available in other database flavors.
Rebased and added test coverage for mysql flavor
@hayd you have this included in SQL ?
@jreback thanks, I'd missed this. Will squish and add in to legacy and sqlalchemy.
@hayd just keeping it on the radar
#2971 is about pandas dropping tables and losing data. That's... not cool.
We should get it fixed for 0.14, regardless of #5950.
@hayd, we pushed 0.13.1 to next week, can you give a push on this for 0.13.1
by any chance?
squished and rebased this branch, will see if it passes/what needs fixing. Agree this was bad, apologies on dropping the ball here. Should make sure this is also fixed in the new stuff.
hayd mentioned this pull request
This PR was rebased by @hayd in #6164 and this PR is merged, so closing.
Labels
to_sql, read_sql, read_sql_query