Hi!
I have following situation: I have 3 tables which stand as a base for
other stuff:
table_virtual_categories = Table("virtual_categories", meta,
Column("id", Integer, primary_key = True),
Column("id_parent", Integer, ForeignKey("virtual_categories.id")),
Column("visible", Boolean, nullable=False, default=False),
Column("kind", String(10), nullable=False),
)
table_virtual_items = Table("virtual_items", meta,
Column("id", Integer, primary_key = True),
Column("id_category", Integer, ForeignKey("virtual_categories.id"),
nullable=False),
Column("kind", String(10), nullable=False),
)
table_virtual_proposals = Table("virtual_proposals", meta,
Column("id", Integer, primary_key = True),
Column("id_previous_version", Integer,
ForeignKey("virtual_proposals.id")),
Column("id_item", Integer, ForeignKey("virtual_items.id"),
nullable=False),
Column("title", Unicode(100)),
Column("dt_inserted", DateTime, nullable=False, default=func.now()),
Column("dt_valid_from", DateTime),
Column("dt_valid_to", DateTime),
Column("version", LUnicode(100), nullable=False),
Column("state", Integer, nullable=False)
)
Now I have some situations where I need to inherit some of these tables
but I want to keep the schema category-item-proposal:
E.g. articles: I need special columns for categories and proposals but
articles (~items) have no extra columns:
table_articles_categories = Table("articles_categories", meta,
Column("id", Integer, ForeignKey("virtual_categories"), primary_key
= True),
Column("description", UnicodeText),
)
table_articles = Table("articles", meta,
Column("id", Integer, ForeignKey("virtual_items"), primary_key = True)
)
table_article_proposals = Table("article_proposals", meta,
Column("id", Integer, ForeignKey("virtual_proposals"), primary_key =
True),
Column("body", UnicodeText),
)
So as you can see the table "articles" is quite redundant because it has
only the primary key column but I didn't find any other way to select
articles directly from the table "virtual_items" according to the column
"kind" without joining to another specialized table. Is there any way
around this to omit the "articles" table?
Thanks for advices.
David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---