Re: MultipleJoin with irregular naming
Oleg Broytman <[email protected]> Thu, 10 Nov 2016 16:32:52 +0100
| Newsgroups | gmane.comp.python.sqlobject |
|---|---|
| Message-ID | <[email protected]> |
Hi! On Thu, Nov 10, 2016 at 04:12:49PM +0100, franz <[email protected]> wrote: > I have two tables whose names I chose by using sqlmeta. > > class Person(SQLObject): > class sqlmeta: > table = 'city_person' > name = StringCol() > pets = MultipleJoin('Animal') > > class Animal(SQLObject): > class sqlmeta: > table = 'city_animal' > name = StringCol() > owner = ForeignKey('Person') > > Now if I say > bob = Person.get(1) > bob.pets > an error occurs because the table `city_animal` has no column > named `city_person_id`. > The real name in table `city_animal` is `person_id` and that > works very well for the foreign key `owner`. But it does not > for the MultipleJoin `pets`. > > I've studied the documentation but didn't find a clue about > how to force the correct naming. Could you give me a hint. > > Thank you Try:: pets = MultipleJoin('Animal', joinColumn='owner_id') Oleg. -- Oleg Broytman http://phdru.name/ [email protected] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi