add find operators

This commit is contained in:
Unknown
2018-06-13 02:29:32 +02:00
parent 38a59b921e
commit f9bb652034
3 changed files with 52 additions and 2 deletions
+17 -1
View File
@@ -138,9 +138,25 @@ We can search for specific entries using :py:meth:`find() <dataset.Table.find>`
# Get a specific user
john = table.find_one(name='John Doe')
# Find by comparison
# Find multiple at once
winners = table.find(id=[1, 3, 7])
# Find by comparison operator
elderly_users = table.find(age={'>=', 70})
possible_customers = table.find(age={'between', [21, 80]})
# Use the underlying SQLAlchemy directly
elderly_users = table.find(table.table.columns.age >= 70)
Possible comparison operators::
gt, >
lt, <
gte, >=
lte, <=
!=, <>, not
between, ..
Using :py:meth:`distinct() <dataset.Table.distinct>` we can grab a set of rows
with unique values in one or more columns::