Hi
I've been using sqlachemy for a month and I like it so far.
Documentation could have been more precise IMO, it is
confusing that the indroduction discusses so many ways
to do the same things. Im partly confused since my prior
experience with orm tools is limited.
Say I was about to make a telephone book database. I
would need four columns: id, first name, last name, and
phone number.
Table('telephone_book', metadata,
Column('id', Integer, primary_key=True),
Column('first', Unicode(100)),
Column('last', Unicode(100)),
Column('phonenumber', String(11))
)
Phone numbers are fairly unique, not many rows in the
table will have the same value. But first names are often
the same. As are last names. Although the set of first
names and the set of last names are fairly disjoint. Hence,
it would make sense to break out the two name columns
into two separate tables to save space.
My question is: how can you do this as transparently as
possible with sqlalchemy? I was thinking along the lines
of a new type called XUnicode (or something). The user
expected behaviour of the two tables (when mapped)
would be exactly the same only database would be more
normalized in the latter case.
Table('telephone_book', metadata,
Column('id', Integer, primary_key=True),
Column('first', XUnicode(100, tablename='first')),
Column('last', XUnicode(100, tablename='last')),
Column('phonenumber', String(11))
)
This would create 3 tables with 'telephone_book'
referencing 'first' and 'last'. I hope my description suffice.
There are lots of implementation details to discuss, I just
wanted to hear from more experienced users if this is a
good way to go? Any input is welcome!
...johahn
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---