Re: [SQLObject] Col naming in MultipleJoin
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Nick <ni...@dd...> - 2003-05-10 18:21:27
|
On Sat, 2003-05-10 at 13:03, deelan wrote: > Nick wrote: > >>this fails: > >>pn = PhoneNumber.new(phone='666', type='home', PersonId=p.id) > >> > >>this works: > >>pn = PhoneNumber.new(phone='666', type='home', PersonID=p.id) > > > > > > Correct; the parameters in SQLObject methods match to the first argument > > to Col, the Pythonic column name, not dbName, the column name in the > > database. > > that's fine, but what i would like to know is why i can't name > the Col "PersonId" and i have to call it "PersonID", this happens > both in the pythonic column name and in the DB column name. No, the dbName can be anything. It doesn't matter what it's called in the database as long as you use it in the dbName parameter. The fact that you have to call a column somethingid is hardcoded in SQLObject. I don't particularly like it, since it's clear in the Col definition that this is a foreign key. I don't particularly see the downside in having to say pn.Person.id vs. pn.PersonID. I think it's more clear if you're really making an object oriented model. So I altered my local code to do this and maintain a patch against CVS. Nick |