versionalchemy.api package

Submodules

versionalchemy.api.data module

versionalchemy.api.data.delete(va_table, session, conds)[source]
Parameters:
  • va_table – the model class which inherits from VAModelMixin and specifies the model of the user table from which we are querying
  • session – a sqlalchemy session with connections to the database
  • conds – a list of dictionary of key value pairs where keys are columns in the table and values are values the column should take on. If specified, this query will only return rows where the columns meet all the conditions. The columns specified in this dictionary must be exactly the unique columns that versioning pivots around.

Performs a hard delete on a row, which means the row is deleted from the versionalchemy table as well as the archive table.

versionalchemy.api.data.get(va_table, session, va_id=None, t1=None, t2=None, fields=None, conds=None, include_deleted=True, page=1, page_size=100)[source]
Parameters:
  • va_table – the model class which inherits from VAModelMixin and specifies the model of the user table from which we are querying
  • session – a sqlalchemy session with connections to the database
  • va_id – if specified, the value of t1 and t2 will be ignored. If specified, this will return all records after the specified va_id.
  • t1 – lower bound time for this query; if None or unspecified, defaults to the unix epoch. If this is specified and t2 is not, this query will simply return the time slice of data at t1. This must either be a valid sql time string or a datetime.datetime object.
  • t2 – upper bound time for this query; if both t1 and t2 are none or unspecified, this will return the latest data (i.e. time slice of data now). This must either be a valid sql time string or a datetime.datetime object.
  • fields – a list of strings which corresponds to columns in the table; If None or unspecified, returns all fields in the table.
  • conds – a list of dictionary of key value pairs where keys are columns in the table and values are values the column should take on. If specified, this query will only return rows where the columns meet all the conditions. The columns specified in this dictionary must be exactly the unique columns that versioning pivots around.
  • include_deleted – if True, the response will include deleted changes. Else it will only include changes where deleted = 0 i.e. the data was in the user table.
  • page – the offset of the result set (1-indexed); i.e. if page_size is 100 and page is 2, the result set will contain results 100 - 199
  • page_size – upper bound on number of results to display. Note the actual returned result set may be smaller than this due to the roll up.