Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Query not returning result when using first() #59

Open
shaloba opened this issue Sep 7, 2017 · 1 comment
Open

Query not returning result when using first() #59

shaloba opened this issue Sep 7, 2017 · 1 comment

Comments

@shaloba
Copy link

shaloba commented Sep 7, 2017

Version: flywheel==0.4.4

I have encountered with an empty result issue when using "first" function on flywheel query object, but got result when using the "all" function (with the same query)

DB schema:


class User(Modal):
__metadata__ = {
        '_name': 'test_table',
        'global_indexes': [
            GlobalIndex('name-age-index', 'name', 'age_min').throughput(5, 3),
        ]
    }
name = Field(hash_key=True)
age_min = Field(data_type=int)      # OPTIONAL
age_max = Field(data_type=int)       # OPTIONAL

Query:

1. engine.query(User).filter(User.name == 'Erik', User.age_min <= age, User.age_max >= 18).first()
result: None

2.  engine.query(User).filter(User.name == 'Erik', User.age_min <= age, User.age_max >= 18).all()
result: [<object>]

@stevearc
Copy link
Owner

stevearc commented Sep 8, 2017

Yep, this is a known bug with that version. It's a dupe of #57 and was fixed in version 0.5.2. If you can't upgrade to the 0.5 branch because of backwards incompatibility I could backport it to 0.4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants