Michael,

On 21/01/2010 03:18, Michael Pedersen wrote:


On Tue, Jan 19, 2010 at 11:30 AM, werner <[email protected] <mailto:[email protected]>> wrote:

    Shouldn't make a difference, but when I changed back to "*", I had
    no link to Genres on the admin page.


I don't have an explanation for this, but would love to see more code about it to try to answer what happened and why.

    What is best practice or recommended way to deal with lots of
    tables in the model?

    Should one keep each table in it's own .py file?

    If yes, how does one best deal with relations?
    - import the needed ones in each .py, or is there a nicer/cleaner
    way of doing this?


How you structure your tables will vary from project to project. A common practice is to structure your tables the same way you would structure your objects, though. After all, SQLAlchemy is an Object Relational Mapper, so you're not specifying your database so much as your objects. So, you manage your SA objects in the same way you manage your Python objects.

Hopefully, that will provide enough of an answer.
How to structure tables is not my problem - at least I don't think so.

Let me try to ask the question differently.

I have following tabels:
tableA (e.g. defining a wine)
tableB (e.g. defining supplier, producer, bottler)  -
tableC (e.g. defining a country)

Both table "A" and "B" have a relation to "C" and "A" has a relation to "B".

Assuming the project will be having quit a few tables (lets say 30+).

I liked how it is shown in the tutorials to have one module.tableX.py file per table, if one does this then one would have to import "C" in both the "A" and "B" file and "B" would also needed to be imported in "A".

Besides not doing any circular imports is there anything else one has to watch out for?

Is this the/a clean way of doing it or are there better ways of handling the relations if one wants to stick with the one table per file structure.

Hope this explains better what I am unsure about.
Werner
--
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