| Home | Trees | Index | Help |
|
|---|
| Package Modeling :: Package DatabaseAdaptors :: Package AbstractDBAPI2AdaptorLayer :: Module AbstractDBAPI2SchemaGeneration :: Class AbstractDBAPI2SchemaGeneration |
|
SchemaGeneration --+
|
AbstractDBAPI2SchemaGeneration
This class is here for information only ; it does not contain any reusable logic. Your concrete SchemaGeneration should inherit directly from Modeling.SchemaGeneration.
See Modeling.interfaces.SchemaGeneration for further details
| Method Summary | |
|---|---|
Returns a list of SQLExpression statements, creating the requested database. | |
Returns a list of SQLExpression statements, dropping the requested database. | |
See Modeling.interfaces.SchemaGeneration for further details | |
Returns a list of SQLExpressions needed to add a constraint statement for the given relationship. | |
See Modeling.interfaces.SchemaGeneration for further details | |
| Inherited from SchemaGeneration | |
See interfaces.SchemaGeneration for details | |
Appends the expression to the StringIO script, prepended with a semi-colon (';') and a newline if the StringIO is not empty. | |
Returns a list of SQLExpressions needed to create the tables defined by the supplied 'entityGroup', or an empty list if 'entityGroup' is empty. | |
Invokes createTableStatementsForEntityGroup() for each entityGroup in 'entityGroups', and returns the list of SQLExpressions needed to create the necessary table. | |
Used in method SchemaGeneration.schemaCreationScriptForEntities() to order the schema creation statements produced (Static method) | |
Default implementation returns an empty list. | |
Default implementation returns an empty list. | |
Iterates on each entityGroup in 'entityGroups', sends the message 'dropPrimaryKeyConstraintStatementsForEntityGroup' to each of them, collects the results and returns them in a sequence. | |
Iterates on each entityGroup in 'entityGroups', sends the message 'dropPrimaryKeySupportStatementsForEntityGroup' to each of them, collects the results and returns them in a sequence. | |
Parameter: | |
Iterates on each entityGroup in 'entityGroups', sends the message 'dropPrimaryKeySupportStatementsForEntityGroup()' to each of them, collects the results and returns them in a sequence. | |
Default implementation returns an empty list. | |
Iterates on each entityGroup in 'entityGroups', sends the message 'primaryKeyConstraintStatementsForEntityGroup' to each of them, collects the results and returns them in a sequence. | |
Iterates on each entityGroup in 'entityGroups', sends the message 'primaryKeySupportStatementsForEntityGroup' to each of them, collects the results and returns them in a sequence. | |
__TBD | |
__TBD doc. | |
__TBD doc. | |
Sets the default ordering. (Static method) | |
Returns a list of entityGroups ; each entityGroup consists of the entities in parameter 'entities' which share the same externalName(), and wich answered positively to the definesTableColumns() message. | |
| Class Variable Summary | |
|---|---|
| Inherited from SchemaGeneration | |
tuple |
__implements__ = (<class Modeling.interfaces.SchemaGener...
|
| Instance Method Details |
|---|
createDatabaseStatementsForConnectionDictionary(self, connectionDictionary, administrativeConnectionDictionary, createUserFlag=1)Returns a list of SQLExpression statements, creating the requested database. See also: interfaces.SchemaGeneration for details |
dropDatabaseStatementsForConnectionDictionary(self, connectionDictionary, administrativeConnectionDictionary, dropUserFlag=1)Returns a list of SQLExpression statements, dropping the requested database. See Modeling.interfaces.SchemaGeneration for details |
dropPrimaryKeySupportStatementsForEntityGroup(self, entityGroup)See Modeling.interfaces.SchemaGeneration for further details See also: AbstractDBAPI2AdaptorChannel.primaryKeysForNewRowsWithEntity() |
foreignKeyConstraintStatementsForRelationship(self, relationship)
Returns a list of SQLExpressions needed to add a constraint statement
for the given relationship. Under specific conditions on 'relationship',
expressed below, that lists consists of a single SQLExpression
statement of the following form::
ALTER TABLE <TABLE> ADD CONSTRAINT <REL_NAME> FOREIGN KEY
(<FKS>) REFERENCES <DESTINATION_TABLE>(<DESTINATION_PK>)
INITIALLY DEFERRED
where TABLE is the relationship's entity externalName(),
REL_NAME is the relationship's source attribute columnName(),
FKS is a comma-separated list of the relationship's source
attributes.columnName(),
DESTINATION_PKS is a comma-separated list of the rel.'s
destinationAttributes().columnName(),
DESTINATION_TABLE is the relationship.destinationEntity() 's
externalName()
The conditions under which the statement above is returned are:
- the relationship is a toOne rel. and it is not flattened,
- its inverseRelationship, if any, is a toMany relationship,
- its source and destinationEntity share the same model
- the destinationEntity has no sub-entity.
If any of these conditions is not fulfilled the method returns an empty
sequence.
Why 'INITIALLY DEFERRED'? Suppose we need to cascade delete 3 objects in
relations ; we do not guarantee that they will be deleted in the correct
order (moreover, determining the order in which objects should be deleted,
or updated, etc. is a difficult problem and solving it is beyond my
knowledge). So, we need to defer the constraint until the transaction
commits. Last, I put it there, not in any specific adaptor, since I do not
want to hide that fact from the eyes of anyone willing to create a custom
AdaptorLayer. If this is what you want to do, and your database does not
allow constraints to be deferred, you'll probably won't add any
referential constraints at all --or you'll solve the general scheduling
problem!
|
primaryKeySupportStatementsForEntityGroup(self, entityGroup)See Modeling.interfaces.SchemaGeneration for further details
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Sat Mar 4 13:36:24 2006 | http://epydoc.sf.net |