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

Fixed filter_condition examples in the docs #1204

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Examples of ways to query your table with filter conditions:

.. code-block:: python

for user in UserModel.query("Denver", UserModel.email=="djohn@company.org"):
for user in UserModel.query("Denver", filter_condition=UserModel.email=="djohn@company.org"):
print(user.first_name)

Retrieve an existing user:
Expand Down
11 changes: 9 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,18 @@ Now, suppose that you want to search the table for users with a last name
for user in UserModel.query('Smith', UserModel.first_name.startswith('J')):
print(user.first_name)

You can combine query terms:
You can combine query terms in filter conditions using OR:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would clarify by saying

You can combine query terms in filter conditions using logical operators (ex, |, &, ==, etc.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review.
I have given a separate example for & just below this one. Not sure how == would work here for combining queries 🤔
Let me know if there are other logical operators that are supported here. I'll either add them in-line or add a separate example if they make more sense that way.


::

for user in UserModel.query('Smith', UserModel.first_name.startswith('J') | UserModel.email.contains('domain.com')):
for user in UserModel.query('Smith', filter_condition=UserModel.email.contains('domain_a.com') | UserModel.email.contains('domain_b.com')):
print(user)

or using AND:

::

for user in UserModel.query('Smith', filter_condition=UserModel.email.startswith('smith') & UserModel.email.contains('domain.com')):
print(user)


Expand Down