Package daklib :: Package database :: Module base :: Class BaseTimestamp
[hide private]
[frames] | no frames]

Class BaseTimestamp

source code


Class Methods [hide private]
 
__table_cls__(cls, *arg, **kw) source code

Inherited from BaseMethods: get

Class Variables [hide private]
  __abstract__ = True
  created = Column(DateTime(timezone= True), nullable= False, se...
  modified = Column(DateTime(timezone= True), nullable= False, s...
  modified_trigger_function = DDL(...
  modified_trigger = DDL(...
Class Variable Details [hide private]

created

Value:
Column(DateTime(timezone= True), nullable= False, server_default= func\
.now())

modified

Value:
Column(DateTime(timezone= True), nullable= False, server_default= func\
.now())

modified_trigger_function

Value:
DDL("""
CREATE OR REPLACE FUNCTION tfunc_set_modified() RETURNS trigger
LANGUAGE plpgsql
AS $$
    BEGIN NEW.modified = now(); return NEW; END;
$$
    """)

modified_trigger

Value:
DDL("""
CREATE TRIGGER %(table)s_modified BEFORE UPDATE ON %(fullname)s
FOR EACH ROW EXECUTE PROCEDURE tfunc_set_modified()
    """)