> > I am trying to connect via SQLObject to the existing database
>
> You didn't mention fromDatabase but I am sure that what you meant,
> right? Because it's certainly possible to connect to an existing database
> without it.
>
> > What I really can not figure out is how to get ForeignKey and
> MultipleJoin
> > working.
>
> By declaring them yourself:
>
> class MyTable(SQLObject):
> class sqlmeta:
> fromDatabase = True
> fk = ForeignKey('AnotherTable')
> mj = MultipleJoin('AnotherTable', joinColumn='at_id')
Thanks for the syntax, it works great.
>
> Explicit declarations are compatible with fromDatabase. And of course
> you are not obliged to use fromDatabase at all - just declare all you
> columns and joins yourself.
>
I have used fromDatabase because my lazybones only.
Of course IWBN if your patch fromDatabase machinery (methods
> columnsFromSchema and guessClass in Connection class) to recognize at least
> ForeignKeys.
>
> IWBN, I would like to. But, to be honest, I think my Pythonic skills are to
low for this task (it is REALLY not about the time or laziness).
Thanks and Best Regards
Petr
|