Skip to content
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

4304r if_exists == 'fail' should actually work #6164

Merged
merged 2 commits into from
Jan 29, 2014
Merged

Conversation

hayd
Copy link
Contributor

@hayd hayd commented Jan 29, 2014

fixes #4110 #4304
#4304 rebased and passes travis.

cc @y-p

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.

BUG: Fix if_exists='replace' functionality in io.sql.write_frame

This should resolve issues pandas-dev#2971 and pandas-dev#4110

CLN: Refactor in between test clean ups to be more DRY

TST: Complete test coverage for if_exists uses in io.sql.write_frame

CLN: Refactor to make interaction between exists and if_exists clearer

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

BUG: Fix regression introduced by c28f11a0041a9f3b25f33b0539e42fa802b1d8d4

sqlite3 convenience function executescript not available
in other database flavors.

TST: Adding if_exist test for mysql flavor
@ghost
Copy link

ghost commented Jan 29, 2014

Did you review the code for sanity?

@ghost
Copy link

ghost commented Jan 29, 2014

I haven't looked at the SQL code. ever.

DOC add to release notes
jreback added a commit that referenced this pull request Jan 29, 2014
4304r if_exists == 'fail' should actually work
@jreback jreback merged commit b4da232 into pandas-dev:master Jan 29, 2014
@jreback
Copy link
Contributor

jreback commented Jan 29, 2014

@hayd looks good....(and nice that you added some more tests).

@hayd
Copy link
Contributor Author

hayd commented Jan 29, 2014

Must take care to not drop this when merging sql stuff in 0.14.

@jreback
Copy link
Contributor

jreback commented Jan 29, 2014

cc @mangecoeur will see this on rebasing....

@hayd
Copy link
Contributor Author

hayd commented Feb 14, 2014

Need to test this with the new sql branch. Will come up when bring back the old sql test file... (which atm I can't get to pass...)

@jorisvandenbossche
Copy link
Member

@hayd Can you take this on? To resurrect the old test suite?

@mangecoeur
Copy link
Contributor

@jorisvandenbossche @hayd I thought I fixed this with the new code? Pretty sure it's in the new tests too - it should test each allowed value of if_exists. Should also raise ValueError if invalid if_exists arg passed, though could probably do with more robust checking in code and tests

@jorisvandenbossche
Copy link
Member

@mangecoeur It is indeed already tested in the new tests. But that doesn't mean that we shouldn't try if the old tests still pass?

@mangecoeur
Copy link
Contributor

@jorisvandenbossche I got the impression on reviewing the legacy tests that they were a bit of a mess, including testing undocumented APIs such as the "retry" option. That was why i ported the coverage to the new test architecture rather than extending the legacy ones - i tried to keep the test concepts rather than the test code.

@jorisvandenbossche
Copy link
Member

OK, fine with me. I think @hayd is more familiar with the previous code base/tests, so maybe he can give a final tought on that.

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.

BUG: in io.sql.write_frame (replace)
5 participants