Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#5 SQLObject should determine joinColumn from Class Name

open
nobody
None
5
2008-05-19
2008-02-03
Till Maas
No

Currently SQLObject determines the joinColumn for MultipleJoin from the name of the table.

In the documentation it is recommended to use "user_table" as a table for an class called User. When one now creates another class, e.g. Address that has a ForeignKey from User in a column called "user", one needs to add joinColumn='user_id' to the MultipleJoin definition within the User class, otherwise one only gets a totally strange python traceback, when one tries to access u.addresses.

I attached a simple example, that makes it more clear, where the problem here is.

I use python-sqlobject-0.9.2-1.fc7 from Fedora.

Discussion

  • Till Maas
    Till Maas
    2008-02-03

    minimal example of described problem with MultipleJoin

     
    Attachments
  • Till Maas
    Till Maas
    2008-02-03

    Logged In: YES
    user_id=60606
    Originator: YES

    Even better would be, if it was possible to use:
    addresses = MultipleJoin(Address.user)
    and then SQLObject would determine by itself whatever the column_id of Address.user is, without the user of SQLObject needing to know how the internalf of SQLObject work.

     
  • Oleg Broytman
    Oleg Broytman
    2008-05-19

    • labels: 504692 -->
    • milestone: 293287 -->