Technically speaking, you cannot do it, and *should* not do it.

However you can hack around this by using a integer type instead of a
FK relationship. Basically store your integer without FK status, and
then you manually handle all of the relationships.

--
Thadeus





On Mon, Jun 7, 2010 at 2:38 PM, kachna <petr.marti...@gmail.com> wrote:
> Hi,
> I am trying to define table with foreign key to the table stored in
> different database on same server  (MySQL).
>
> db_sys # db_sys on localhost mysql
> db_cs # db_cs on localhost mysql
>
> db_sys.define_table('item',
>  Field('id_producer', db_sys.producer, requires=IS_IN_DB(db_sys,
> 'producer.id', '%(name)s (%(id)s)', error_message=T('Vyrobce neni v
> databazi'))),
>  Field('catalogue_no', 'string', label=T('Katalogove cislo'),
> notnull=True),
>  Field('name', 'string', label=T('Polozka (interne)'))
> )
>
> db_cs.define_table('item',
>  Field('title', 'string', label=T('Nazev')),
>  Field('description', 'text', label=T('Popis'))
> )
>
> after execution I get:
> ....sql.py", line 1576, in _create_references
>  SyntaxError: Table: table "item" does not exist
>
> I quick-check sources and I thing that there is not too much work to
> make it work fine. Am I wrong? Is there different way?
>
> thx
>

Reply via email to