I'm pretty new to Pyramid, and I can't figure out how to use the autoload=true option in Pyramid. I used the pyramid_routesalchemy to create my project using paster.
The problem is that there is an init.py file which uses the initialize_sql (and this function defines Base.metadata.bind = engine). In one of my model classes I would like to use the autoload=true option (using the declarative base), but I always get the following error:
sqlalchemy.exc.UnboundExecutionError: No engine is bound to this Table's MetaData. Pass an engine to the Table via autoload_with=<someengine>, or associate the MetaData with an engine via metadata.bind=<someengine>
Actually Base.metadata.bind = engine is defined inside the initialize_sql function and I do not realy know in which order the file are loaded, but I'm almost sure that that init.py is loaded before the model, and thus metadata was already binded to the engine...
Thus, my question: how can use autoload within my classes without changing the whole init and model structure ?
If anyone has a hint... Thanks in advance