With Pyramid in particular you can use its code scanning feature to find and load all modules with your modes without having to explicitly import them. Code scanning is used in Pyramid to find @view_config decorators, but you can use it for other purposes too.
http://docs.pylonsproject.org/projects/pyramid/en/1.0-branch/narr/configuration.html#configuration-decorations-and-code-scanning On Thursday, August 2, 2012 2:07:54 AM UTC+10, John Anderson wrote: > > In my pyramid apps I have a create script that generates my database for > production and a different script that generates my database for my tests. > > But if I don't import the module the models are in then they aren't > discovered even though they all share the same Base which is the class I > get the metadata from to call create_all, like: > > Base.metadata.create_all(engine) > > If I import them then they are picked up but I don't want to have to > remember to import every new module I create. Is there a good way to do > model discovery for this? > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/IcoyXIOobA4J. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.