Hi!
On Thu, Nov 10, 2016 at 04:12:49PM +0100, franz <fra...@gm...> 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/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|