-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
thanks a lot jason, now i see the metadata version of the same. alex jason kirtland wrote: | alex bodnaru wrote: |> hi friends, |> |> i wish to insert some initial data in a few management tables (like applications |> groups, roles etc). |> |> is there a way to register dml to be done after create_all ends? |> |> i'd specifically like it to happen after the entire ddl dust reaches the ground. | | MetaData and Tables emit DDL events that you can listen for with | .append_ddl_listener. | | http://www.sqlalchemy.org/docs/04/sqlalchemy_schema.html#docstrings_sqlalchemy.schema_MetaData | | Here's an example insert-after-CREATE function from the SA test suite: | | def fixture(table, columns, *rows): | """Insert data into table after creation.""" | def onload(event, schema_item, connection): | insert = table.insert() | column_names = [col.key for col in columns] | connection.execute(insert, | [dict(zip(column_names, column_values)) | for column_values in rows]) | table.append_ddl_listener('after-create', onload) | | | | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBSGgW8tpwN1sq38njAQKUsQP/UmbeNlPKzYGGAnjnk4/axjYtasO8HAUg jRcRp57J9L0t0UFXE9Lyra66wywSM0fg80Q4ajEEcTQFyh8DOwwbuoJT55pQyV+e BJ8lw379eCdVsHhdA/fFg/vIjZF96qFXHfCj6UnFrk9Gsk/mLWuWqUZPSd8dyS3M yUeDOWzs5vI= =7KPc -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
