Query
This module contains functions that generate query objects,
suitable to be passed into FaunaClient.query.
In addition to these functions, queries may contain:
None
- Numbers (
1, 2.5)
- Strings (
"foo")
- Lists (
[1, "foo"])
- Dicts (
{"foo": "bar"})
- A
Ref, SetRef, FaunaTime, or datetime.date.
For example: select("a", {"a": Ref("widgets", 123)}).
-
faunadb.query.add(*numbers)
See the docs.
-
faunadb.query.and_expr(*booleans)
See the docs.
-
faunadb.query.append(elements, collection)
See the docs.
-
faunadb.query.casefold(string)
See the docs.
-
faunadb.query.class_expr(class_name)
See the docs.
-
faunadb.query.concat(strings, separator=None)
See the docs.
-
faunadb.query.contains(path, in_)
See the docs.
-
faunadb.query.create(class_ref, params)
See the docs.
-
faunadb.query.create_class(class_params)
See the docs.
-
faunadb.query.create_database(db_params)
See the docs.
-
faunadb.query.create_index(index_params)
See the docs.
-
faunadb.query.create_key(key_params)
See the docs.
-
faunadb.query.database(db_name)
See the docs.
-
faunadb.query.date(string)
See the docs.
-
faunadb.query.delete(ref)
See the docs.
-
faunadb.query.difference(*sets)
See the docs.
-
faunadb.query.distinct(set)
See the docs.
-
faunadb.query.divide(*numbers)
See the docs.
-
faunadb.query.do(*expressions)
See the docs.
-
faunadb.query.drop(number, collection)
See the docs.
-
faunadb.query.epoch(number, unit)
See the docs.
-
faunadb.query.equals(*values)
See the docs.
-
faunadb.query.exists(ref, ts=None)
See the docs.
-
faunadb.query.filter_expr(expr, collection)
See the docs.
-
faunadb.query.foreach(expr, collection)
See the docs.
-
faunadb.query.get(ref, ts=None)
See the docs.
-
faunadb.query.gt(*values)
See the docs.
-
faunadb.query.gte(*values)
See the docs.
-
faunadb.query.identify(ref, password)
See the docs.
-
faunadb.query.if_expr(condition, then, else_)
See the docs.
-
faunadb.query.index(index_name)
See the docs.
-
faunadb.query.insert(ref, ts, action, params)
See the docs.
-
faunadb.query.intersection(*sets)
See the docs.
-
faunadb.query.join(source, target)
See the docs.
-
faunadb.query.lambda_expr(var_name_or_pattern, expr)
See the docs.
-
faunadb.query.lambda_query(func)
See the docs.
This form generates var objects for you, and is called like:
query.lambda_query(lambda a: query.add(a, a))
# Produces: {
# "lambda": "a",
# "expr": {"add": ({"var": "a"}, {"var": "a"})}
# }
You usually don’t need to call this directly as lambdas in queries will be converted for you.
For example: query.map_expr(lambda a: query.add(a, 1), collection).
You can also use lambda_expr directly.
| Parameters: | func – Takes one or more var expressions and uses them to construct an expression.
If this has more than one argument, the lambda destructures an array argument.
(To destructure single-element arrays use lambda_expr.) |
-
faunadb.query.let(vars, in_expr)
See the docs.
-
faunadb.query.login(ref, params)
See the docs.
-
faunadb.query.logout(delete_tokens)
See the docs.
-
faunadb.query.lt(*values)
See the docs.
-
faunadb.query.lte(*values)
See the docs.
-
faunadb.query.map_expr(expr, collection)
See the docs.
-
faunadb.query.match(index, *terms)
See the docs.
-
faunadb.query.modulo(*numbers)
See the docs.
-
faunadb.query.multiply(*numbers)
See the docs.
-
faunadb.query.next_id()
See the docs.
-
faunadb.query.not_expr(boolean)
See the docs.
-
faunadb.query.or_expr(*booleans)
See the docs.
-
faunadb.query.paginate(set, size=None, ts=None, after=None, before=None, events=None, sources=None)
See the docs.
You may want to convert the result of this to a Page.
-
faunadb.query.prepend(elements, collection)
See the docs.
-
faunadb.query.remove(ref, ts, action)
See the docs.
-
faunadb.query.replace(ref, params)
See the docs.
-
faunadb.query.select(path, from_)
See the docs.
See also select_with_default().
-
faunadb.query.select_with_default(path, from_, default)
See the docs.
-
faunadb.query.subtract(*numbers)
See the docs.
-
faunadb.query.take(number, collection)
See the docs.
-
faunadb.query.time(string)
See the docs.
-
faunadb.query.union(*sets)
See the docs.
-
faunadb.query.update(ref, params)
See the docs.
-
faunadb.query.var(var_name)
See the docs.