-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
ENH: sql support via SQLAlchemy, with legacy fallback #5950
Conversation
need to rebase away the merged branchs (makes history cleaner) do this:
delete the tracked branch
can also combine/squash branch as you see fit (you can do this later if you want)...post comments |
|
||
For example, suppose you want to query some data with different types from a | ||
table such as: | ||
If SQLAlchemy is not installed a legacy fallback is provided for sqlite and mysql. |
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.
add a new in version 0.14 tag (it might make it to 0.13.1...let's see)
@mangecoeur instead of |
@jtratner , @hayd you guys were involved at the design stage for this, is there something |
@mangecoeur , please update the optional dependencies secion of the README and @jreback, should we ask for a @SQL decorator on these tests, what do you think? |
also pls edit install.rst with the same requirements u may want to test with an older version of sqlalchemy that is popular |
Ok I slept on it, I now agree that automatic datatime conversion needs to be part of this feature. I will try testing with SQLAlchemy 0.8 , I think that's probably the most widespread version. I don't anticipate any issues, their core api is stable. Please add any more comments/suggestions and I will implement them in the coming week or so. |
@mangecoeur, please don't merge master into your PR branches. |
Sorry, didn't realize, was just doing the workflow i was used to... can try On Monday, January 20, 2014, y-p [email protected] wrote:
|
Legitimate, but we're settled on using rebase in pandas. |
ref to #5936 |
@mangecoeur can you rebase and squash a bit...... my brief look says that this does not break API's... thoughts on inclusion in 0.13.1 ? |
I don't see any problems, but I'd like to see it sit on master for at least a week (two weeks?) before it's rolled into a release. Just one man's opinion though. How firm is that 6-day timeline on the 0.13.1 milestone? |
@mangecoeur also need to remove all tracking/merge branches |
This is a big feature, which I would normally associate with a major release. If you'd like to ship it as experimental in 0.13.1 and if the old code is still working, |
@danielballan will be at least that long....0.13 really just rolled out... |
The point of quickly releasing 0.13.1 is to ensure a stable version is available (see various That's the idea anyway. |
OK, just basing that on the milestone. Then I don't see a problem. Has anyone done benchmarks on SQLA-mediated connections vs. MySQLdb / sqlite as it's set up now? I volunteer, once it's in master. |
It's become obvious that the RC's really don't get that much extra testing. I'd love a better solution, do you have a hypnotic ray I can borrow to get people to test our RC's? |
TST Import sqlalchemy on Travis. DOC add docstrings to read sql ENH read_sql connects via Connection, Engine, file path, or :memory: string CLN Separate legacy code into new file, and fallback so that all old tests pass. TST to use sqlachemy syntax in tests CLN sql into classes, legacy passes FIX few engine vs con calls CLN pep8 cleanup add postgres support for pandas.io.sql.get_schema WIP: cleaup of sql io module - imported correct SQLALCHEMY type, delete redundant PandasSQLWithCon TODO: renamed _engine_read_table, need to think of a better name. TODO: clean up get_conneciton function ENH: cleanup of SQL io TODO: check that legacy mode works TODO: run tests correctly enabled coerce_float option Cleanup and bug-fixing mainly on legacy mode sql. IMPORTANT - changed legacy to require connection rather than cursor. This is still not yet finalized. TODO: tests and doc Added Test coverage for basic functionality using in-memory SQLite database Simplified API by automatically distinguishing between engine and connection. Added warnings
Initial draft of doc updates minor doc updates Added tests and reduced code repetition. Updated Docs. Added test coverage for legacy names Documentation updates, more tests Added depreciation warnings for legacy names. Updated docs and test doc build ENH #4163 - finalized tests and docs, ready for wider use… TST added sqlalchemy to TravisCI build dep for py 2.7 and 3.3 TST Import sqlalchemy on Travis. DOC add docstrings to read sql ENH read_sql connects via Connection, Engine, file path, or :memory: string CLN Separate legacy code into new file, and fallback so that all old tests pass. ENH #4163 added version added coment ENH #4163 added depreciation warning for tquery and uquery ENH #4163 Documentation and tests
Squashed the history into 3 commits with more or less informative messages (not so used to using git this way, but hopefully shouldn't have screwed anything up) Let me know how to finish this to get this merged to master, it certainly needs to be exercised in the real world to see how people get on, this should generate some new issues for improving in the next release. On the docs - because they've been changed quite a bit to cover sqlalchemy and the read_table function I don't think it makes sense to split them out as they stand. I feel confident we could push the whole thing to master and see how people get on. |
How do we envisage the user API?
To finish summary: also deprecated are |
@mangecoeur @jorisvandenbossche we can merge this as soon as you are ready (at least passes green)...don't worry about extra features atm |
@jreback @jorisvandenbossche ok just want to fix the bug where specifying the same name in index_col and parse_dates causes an error, then we should be good to go. |
@jreback @jorisvandenbossche Done. Read to merge when you are. Might need some instructions on how to actually do this... |
@mangecoeur need you to rebase on master https://github.com/pydata/pandas/wiki/Using-Git if you are having issues, ping back |
TST Import sqlalchemy on Travis. DOC add docstrings to read sql ENH read_sql connects via Connection, Engine, file path, or :memory: string CLN Separate legacy code into new file, and fallback so that all old tests pass. TST to use sqlachemy syntax in tests CLN sql into classes, legacy passes FIX few engine vs con calls CLN pep8 cleanup add postgres support for pandas.io.sql.get_schema WIP: cleaup of sql io module - imported correct SQLALCHEMY type, delete redundant PandasSQLWithCon TODO: renamed _engine_read_table, need to think of a better name. TODO: clean up get_conneciton function ENH: cleanup of SQL io TODO: check that legacy mode works TODO: run tests correctly enabled coerce_float option Cleanup and bug-fixing mainly on legacy mode sql. IMPORTANT - changed legacy to require connection rather than cursor. This is still not yet finalized. TODO: tests and doc Added Test coverage for basic functionality using in-memory SQLite database Simplified API by automatically distinguishing between engine and connection. Added warnings
Initial draft of doc updates minor doc updates Added tests and reduced code repetition. Updated Docs. Added test coverage for legacy names Documentation updates, more tests Added depreciation warnings for legacy names. Updated docs and test doc build ENH #4163 - finalized tests and docs, ready for wider use… TST added sqlalchemy to TravisCI build dep for py 2.7 and 3.3 TST Import sqlalchemy on Travis. DOC add docstrings to read sql ENH read_sql connects via Connection, Engine, file path, or :memory: string CLN Separate legacy code into new file, and fallback so that all old tests pass. ENH #4163 added version added coment ENH #4163 added depreciation warning for tquery and uquery ENH #4163 Documentation and tests
Conflicts: ci/requirements-2.6.txt doc/source/io.rst pandas/io/sql.py pandas/io/tests/test_sql.py
@jreback done, waiting for travis builds had to fix a py3.3 compat thing, should be ok |
once you pass lmk; I can fix the rebase (e.g. you shouldn't have a merge of master branch in their)..... |
Ok will do, i had trouble getting the rebase to work, loads of merge conflicts... |
@jreback Travis builds passing, enjoy! |
@mangecoeur take a look see at this rebased branch. looks ok? (and the tests all pass, but skipping some, though I see that yours did too).
|
@jreback perhaps needs to add pymysql to travis (which is the only mysql driver used currently in the tests..) |
@jreback Did you squash it down to one commit? Because it would maybe be nice to keep the commits of mangeceour to give him the credit |
I agree let me do it again course if u would like to rebase it |
merged via c7e3058 thanks! |
ok.....if someone would form a new / consolidate SQL page with the todos: obviously more testing with postgres / MySQL and need to skip if the module is installed but no server is up (e.g. installing pymsql but not running it shows an Operationalerror) |
@jreback I will open a new 'meta' issue with a to do list (or better open seperate issues for the different tasks/bugs?) And there are still some merge problems to clean up in the docs, see eg c7e3058#diff-bb262b5e18f651a4357476b250d4b255R3111 |
@jorisvandenbossche that would be gr8 rebase wasn't perfect...prob did miss some doc stuff.....go ahead and fix! @hayd yep...that's next on tap making travis test everything pls consolidate / close SQL issues as needed (as he merge didn't do it because I pushed to master) |
Fixed the merge conflicts in the docs: db2f6d9 @mangecoeur Maybe you should also have a look to check that all your latest changes are correctly commited to master. |
And opened a new issue #6292 for the follow-up. |
Code, tests, and docs for an updated io.sql module which uses SQLAlchemy as a DB abstraction layer. A legacy fallback is provided for SQLite and MySQL. The api should be backwards compatible, with depreciated names marked as such.