Snapshot API#

Model a set of read-only queries to a database as a snapshot.

class, read_timestamp=None, min_read_timestamp=None, max_staleness=None, exact_staleness=None)[source]#


Allow a set of reads / SQL statements with shared staleness.


If no options are passed, reads will use the strong model, reading at a timestamp where all previously committed transactions are visible.

  • session (Session) – the session used to perform the commit.
  • read_timestamp (datetime.datetime) – Execute all reads at the given timestamp.
  • min_read_timestamp (datetime.datetime) – Execute all reads at a timestamp >= min_read_timestamp.
  • max_staleness (datetime.timedelta) – Read data at a timestamp >= NOW - max_staleness seconds.
  • exact_staleness (datetime.timedelta) – Execute all reads at a timestamp that is exact_staleness old.