On Dec 21, 2007, at 11:09 AM, Alexandre da Silva wrote:
> it would be just a Method like after_create_execute("SOME DATABASE
> SPECIFIC SQL"), and this method should be called after creation of
> table, but just on creation... would be usefull have an
> before_drop_execute("SOME STATEMENT") to make users able to drop these
> related object in case of automatic database recreation
we have a ticket in the works for this:
http://www.sqlalchemy.org/trac/ticket/903
> if the feature above is not ready, I will put a staticmethod on each
> mapped class to define my default data and related objects, and will
> call it for each mapped class.
>
> the methods can contain something like this:
>
> def get_trigger_metadata():
> return "CREATE OR REPLACE TRIGGER...."
>
> def initialize_table():
> return "INSERT INTO TABLE_NAME VALUES (1,"Lorem Ipsun","foo","bar")"
>
note that this feature applies to Table objects, not ORM mapped
classes. A central tenet of SQLAlchemy is that the object relational
mapper is an optional package which is completely decoupled from
database schema definition. If you're looking to define mapped
classes and schema declaration together theres a tool called Elixir
that does that.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---