From 71b01adc7b31baab7bbcf40123633b87ee53bf64 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 6 Sep 2018 10:44:09 -0400 Subject: Clarify init_scalar event use case Since I didn't even realize what this was for when reading the docs, make it clearer that this is to mirror a Column default and remove the extra verbiage about the mechanics of INSERTs. Change-Id: Id2c6a29800f7b723573610e4707aec7e6ea38f5f --- examples/custom_attributes/active_column_defaults.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'examples') diff --git a/examples/custom_attributes/active_column_defaults.py b/examples/custom_attributes/active_column_defaults.py index e24fcc069..dd823e814 100644 --- a/examples/custom_attributes/active_column_defaults.py +++ b/examples/custom_attributes/active_column_defaults.py @@ -90,6 +90,11 @@ if __name__ == '__main__': # not persisted at all, default values are present the moment # we access them assert w1.radius == 30 + + # this line will invoke the datetime.now() function, and establish + # its return value upon the w1 instance, such that the + # Column-level default for the "timestamp" column will no longer fire + # off. current_time = w1.timestamp assert ( current_time > datetime.datetime.now() - datetime.timedelta(seconds=5) -- cgit v1.2.1