ForeignKeyConstraint is a table-level definition, ForeignKey is a
column level.  If you have just a single ForeignKey on a single column,
they are equivalent.  for a composite foreign key, ForeignKeyConstraint
gives you the extra verbosity needed (i.e. its exactly analgous to
SQL's FOREIGN KEY clause which can be placed on a column or on the
table overall).

"on_update" within ForeignKeyConstraint will place a "ON
UPDATE=<something>" directive on your table's DDL definition.  This is
SQL level cascading and is described:

http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html
(scroll down to "REFERENCES reftable [ ( refcolumn ) ]")

the thing that "cascades" here is the update of a column value, such as
UPDATE <sometable> SET x=5.

the "cascade" flag on relation() also relates to the "cascading" of
data along a relationship, but is talking about a relationship between
two objects, and refers to various session operations such as save(),
update(), delete(), etc.

the thing that "cascades" here is a session call such as
session.delete(x).

so the term "cascade" refers to a general class of behavior (traversing
along some kind of relationship), but has two totally different
meanings in context (your database tables vs. a SQLAlchemy session
object)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sqlalchemy
-~----------~----~----~----~------~----~------~--~---

Reply via email to