API Reference#

Mixins#

class mortar_sqlalchemy.Common#
class mortar_sqlalchemy.Temporal(**kw)#
classmethod value_at(timestamp)#

Returns a clause element that returns the current value

set_for_period(session, coalesce=True, set_logging=20, change_logging=30, unchanged_logging=10)#

Set the temporal value using the values in self for the keys specified in self over the period specified in self.

self should not be attached to any session; the session to the database in which changes should be made should be passed as session.

It is assumed that the bounds of periods in the table are [).

If coalesce is True, then where values are the same over a period affected by this operation, they will be merged into one database row.

The case where period is open ended going forwards is special cased such that if it would replace future records that have a different value, it is instead closed at the point in time where the period of the earliest overlapping record ends.

Testing#