summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-09-06 10:44:09 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-09-06 10:44:09 -0400
commit71b01adc7b31baab7bbcf40123633b87ee53bf64 (patch)
treef0113362f57317ff9c3019e816c40557aca4c828 /examples
parent081d4275cf5c3e6842c8e0198542ff89617eaa96 (diff)
downloadsqlalchemy-71b01adc7b31baab7bbcf40123633b87ee53bf64.tar.gz
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
Diffstat (limited to 'examples')
-rw-r--r--examples/custom_attributes/active_column_defaults.py5
1 files changed, 5 insertions, 0 deletions
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)