On Mon, Feb 01, 2010 at 08:40:48PM +0100, Petr Jake?? wrote:
> 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')
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.
Of course IWBN if your patch fromDatabase machinery (methods
columnsFromSchema and guessClass in Connection class) to recognize at least
ForeignKeys.
Oleg.
--
Oleg Broytman http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|