Hi Chad,

>But the session object is only connected to the default model that was
>created in model.py I can't seem to be able to make it update the
>database for any other models in my application.
>  
>
If you're using TG 1.0.3 or later, the session isn't bound to any 
database and can hold objects from multiple databases [1]. I am doing 
this successfully in a production app, although using ActiveMapper 
instead of Elixir.

>1. specify in the configuration file url_one = "sqlite:\\\db1.sqlite"
>and url_two = "sqlite:\\\db2.sqlite"
>  
>
Not possible in TG1.0 (although should be in 1.1). You'll need to create 
the second and subsequent metadatas in your code.

>2. have seperate model definition files model_one.py, model_two.py
>  
>
The recommended approach is to create a model subdirectory, and put an 
appropriate __init__.py in it.

>3. attach model_one's metadata to url_one and model_two's metadata to
>url_two
>  
>
With ActiveMapper this is easy, you set __metadata__ in each model. Not 
sure if Elixir has an equivalent; try asking on the Elixir list. Anyway, 
for now, you can specify metadata manually on each table.

>4. have Elixir's create_all() function create the database tables in
>the database associated with the url
>   (when necessary during development)
>  
>
>5. in a controller be able to access both models, create instances,
>select objects from the database backends and commit changes to the
>database.
>  
>
>6. ideally I'd like to be able to specify that any required session
>objects are setup before entering an @exposed controller method and
>changes commited if required on exit.
>  
>
These three points should all "just work". Are you having particular 
problems?

Paul

[1] 
http://groups.google.com/group/turbogears-trunk/browse_frm/thread/e7cfa1d6c87baebb/eb1d1f977ecd9ec1?lnk=st&q=turbogears+sqlalchemy+multiple&rnum=4#eb1d1f977ecd9ec1

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to