[SQLObject] MultipleJoin with irregular naming
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: franz <fra...@gm...> - 2016-11-10 15:12:58
|
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
|