summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-07-12 16:44:18 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-07-12 16:44:18 +0000
commitbbd63bb0e27313bacaf7c0f3cf82c01ace3ec79c (patch)
treecd78a4ce627c0ae79bc6d1cd465ad1c89149a216
parent8415bedf36f3dff4b76ccece85b22d4189e62ab3 (diff)
downloadsqlalchemy-bbd63bb0e27313bacaf7c0f3cf82c01ace3ec79c.tar.gz
clarified passivedefault only for INSERT, added brief 'override reflected columns' example
-rw-r--r--doc/build/content/metadata.txt14
1 files changed, 12 insertions, 2 deletions
diff --git a/doc/build/content/metadata.txt b/doc/build/content/metadata.txt
index 006971f6e..48941347a 100644
--- a/doc/build/content/metadata.txt
+++ b/doc/build/content/metadata.txt
@@ -177,6 +177,16 @@ This works because when the Table constructor is called for a particular name an
>>> othertable is news_articles
True
+##### Overriding Reflected Columns {@name=overriding}
+
+Individual columns can be overridden with explicit values when reflecting tables; this is handy for specifying custom datatypes, constraints such as primary keys that may not be configured within the database, etc.
+
+ {python}
+ >>> mytable = Table('mytable', meta,
+ ... Column('id', Integer, primary_key=True), # override reflected 'id' to have primary key
+ ... Column('mydata', Unicode(50)), # override reflected 'mydata' to be Unicode
+ ... autoload=True)
+
#### Specifying the Schema Name {@name=schema}
Some databases support the concept of multiple schemas. A `Table` can reference this by specifying the `schema` keyword argument:
@@ -327,7 +337,7 @@ To use an explicit ColumnDefault object to specify an on-update, use the "for_up
#### Inline Default Execution: PassiveDefault {@name=passive}
-A PassiveDefault indicates a column default or on-update value that is executed automatically by the database. This construct is used to specify a SQL function that will be specified as "DEFAULT" when creating tables, and also to indicate the presence of new data that is available to be "post-fetched" after an insert or update execution.
+A PassiveDefault indicates an column default that is executed upon INSERT by the database. This construct is used to specify a SQL function that will be specified as "DEFAULT" when creating tables.
{python}
t = Table('test', meta,
@@ -341,7 +351,7 @@ A create call for the above table will produce:
mycolumn datetime default sysdate
)
-PassiveDefaults also send a message to the `Engine` that data is available after update or insert. The object-relational mapper system uses this information to post-fetch rows after insert or update, so that instances can be refreshed with the new data. Below is a simplified version:
+PassiveDefault also sends a message to the `Engine` that data is available after an insert. The object-relational mapper system uses this information to post-fetch rows after the insert, so that instances can be refreshed with the new data. Below is a simplified version:
{python}
# table with passive defaults