Objects

Types used in queries and responses. See the docs.

class faunadb.objects.FaunaTime(value)

FaunaDB time. See the docs.

For dates, regular datetime.date objects are used.

__init__(value)
Parameters:value – If a datetime.datetime is passed, it is converted to a string. Must include an offset.
to_datetime()

Convert to an offset-aware datetime object. This is lossy as datetimes have microsecond rather than nanosecond precision.

class faunadb.objects.Ref(*parts)

FaunaDB ref. See the docs.

A simple wrapper around a string which can be extracted using ref.value. Queries that require a Ref will not work if you just pass in a string.

__init__(*parts)

Create a Ref from a string, such as Ref("databases/prydain"). Can also call Ref("databases", "prydain") or Ref(Ref("databases"), "prydain").

id()

Removes the class part of the Ref, leaving only the id. This is everything after the last /.

to_class()

Gets the class part out of the Ref. This is done by removing the id. So Ref("a", "b/c").to_class() will be Ref("a/b").

class faunadb.objects.SetRef(set_ref)

FaunaDB Set. This represents a set returned as part of a response. For query sets see Query.

__init__(set_ref)