On Wed, Sep 30, 2009 at 1:04 PM, Adrian von Bidder <[email protected]>wrote:
> Heyho! > > Is there a tutorial on vertical partitioning? > > I have a table "Entry" and a table "EntryFlags" (1:1 relation from > EntryFlags to Entry). The idea is that while there is a large number of > "Entry" rows only a small number has flags set (and thus needs an entry in > EntryFlags; note that they don't need to be booleans, despite the name). > > So having a separate table for the EntryFlags keeps the rows of Entry > smaller and should also speed up if I select by certain flags. > > How do I represent this in sqlalchemy? > > Obviously I can trivially do the relation stuff to get entry.flags.myflag, > but nicer would be having the columns from the EntryFlags table appear in > Entry as if they were inline, returning a default value where an EntryFlags > column doesn't exist. (Bonus for removing the EntryFlags row if all values > are back to default ;-) > > Thanks in advance. > > -- vbi > > > -- > The use of COBOL cripples the mind; its teaching should, therefore, be > regarded as a criminal offence. > -- E. Dijkstra, 1975 > Check out the "Customizing Column Properties" in the Mapper Configuation docs: http://www.sqlalchemy.org/docs/05/mappers.html#customizing-column-properties If I understand correctly, this should do what you want. (Disclaimer: haven't done it myself, YMMV) Kevin Horn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
