Skip to content

FIX: hdfstore queries of the form where=[('date', '>=', datetime(2013,1,... #6313

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

Merged
merged 4 commits into from
Feb 17, 2014

Conversation

hhuuggoo
Copy link

@hhuuggoo hhuuggoo commented Feb 9, 2014

FIX: hdfstore queries of the form where=[('date', '>=', datetime(2013,1,1)), ('date', '<=', datetime(2014,1,1))] were broken
- modified Expr.parse_back_compat to check for tuples, in w, and unpack into w, op, value
- modified Expr.__init__ to modify the where list/tuple with the parsed result

@jreback
Copy link
Contributor

jreback commented Feb 9, 2014

hmm

did u check master with this; I thought I had fixed this already

@jreback
Copy link
Contributor

jreback commented Feb 9, 2014

would also need some tests for this

@hhuuggoo
Copy link
Author

hhuuggoo commented Feb 9, 2014

It broke for me in master, I'll add some tests though. But first - is this the right way to fix it? I don't know the pandas codebase that well

@jreback
Copy link
Contributor

jreback commented Feb 9, 2014

where u made the change is fine
their are already a bunch of tests for the back compat formats
so just add them their (u can add as another test function)
need to make sure that fix doesn't break anything

@jreback
Copy link
Contributor

jreback commented Feb 12, 2014

this is fine...can you add a release note (in bug section of 0.14; reference this PR number)

@jreback jreback added this to the 0.14.0 milestone Feb 12, 2014
@jreback
Copy link
Contributor

jreback commented Feb 14, 2014

@hhuuggoo can you add a release note, otherwise looks ready to go

@jreback
Copy link
Contributor

jreback commented Feb 16, 2014

can you rebase...

and add a test that does an assert_produces_warning...that validates that you are in fact showing the warning int he correct place

thanks

hugo added 3 commits February 17, 2014 14:24
…,1,1)), ('date', '<=', datetime(2014,1,1))] were broken

- modified Expr.parse_back_compat to check for tuples, in w, and unpack into w, op, value
- modified Expr.__init__ to modify the where list/tuple with the parsed result
@hhuuggoo
Copy link
Author

I did it - however something wierd happens. The test is fine if ran with others, however if I run it on it's own using the following:

nosetests -s pandas/io/tests/test_pytables.py:TestHDFStore.test_backwards_compat_without_term_object

AssertionError: Caused unexpected warning(s): ['PendingDeprecationWarning'].

I see some comments about this in the test as well, so it seems like it's a persistent problem?

@hhuuggoo
Copy link
Author

@jreback btw, do you know why the query syntax changed? Is there some discussion of this online I can read?

@jreback
Copy link
Contributor

jreback commented Feb 17, 2014

that deprecation warning is a weird thing...I have seen it using assert_produces_warning - and I can't narrow down why it actually happens

what do you mean why the query syntax changed? The original 'syntax' was just a hack...you could do anything beyond anding and too much verbiage to do anything...

is their a problem?

@jreback
Copy link
Contributor

jreback commented Feb 17, 2014

there was a whole very long discussion on this...search for 'eval' in the issues....

@hhuuggoo
Copy link
Author

@jreback, no problem for me, but personally I prefer the old syntax, because it's easier to programatically build up queries using lists and tuples, rather than doing string operations. Not a problem, I can always pull out the backwards compat code in my application if I really need to.

anyways I think this PR is done?

@jreback jreback merged commit 3ca1afe into pandas-dev:master Feb 17, 2014
@jreback
Copy link
Contributor

jreback commented Feb 17, 2014

@hhuuggoo thanks!

its not that difficult to put in a combiner to handle built up queries (of say list of sub-queries)...
you may need a wrapper class (which basically does what the older code did, but ends up stringifying)

I think that is done now (but maybe only if you pass Terms...can't remember)

interested?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Compat pandas objects compatability with Numpy or Python functions IO HDF5 read_hdf, HDFStore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants