On Nov 7, 2007, at 6:34 AM, Koen Bok wrote:
> > Hi there, > > We have a pretty large project by now and we run into import loops. So > I decided to restructure the code, and I hoped some people with more > experience can comment on this. > > The basic problem is this: > > We have the database object code, mappers and tables neatly organized > in one module (db). The controller code imports this module to get > access to these objects. All fine. > > But we have another object called Connection which is a singleton > class that actually manages the connection to our database. It is > basically a wrapper for create_engine and contextual_session. But next > to that it keeps info about the current login state like the employee, > location etc. The mapped database objects need this info on their turn > to add the current user to a new object etc. So the Connection object > depends on the Mapped Database Objects, but the Mapped Database Object > depend on the Connection object too. > > Anyone got a good tip to solve this? Or designed something similar? > if you really have an import cycle that cant be broken, you can place "imports" at the level of the functions which need them....just a thought.... --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---