This should do it:
src=db.hosts.with_alias('src')
dst=db.hosts.with_alias('dst')
rows=db(db.transmissions.src==src.id)
(db.transmissions.dst==dst.id).select(src.ALL, dst.ALL)
print rows
On Feb 19, 2:57 pm, angleto <[email protected]> wrote:
> Hi,
> I have a db like this:
>
> db.define_table("hosts",
> SQLField("dns_hostname", "string", notnull=True,
> default=None,unique=True))
>
> db.define_table("transmissions",
> SQLField("src", db.hosts),
> SQLField("dst", db.hosts),
> SQLField("data", "integer", notnull=True, default=None))
>
> db.transmissions.src.requires=IS_IN_DB(db,
> 'hosts.id','hosts.dns_hostname')
> db.transmissions.dsr.requires=IS_IN_DB(db,
> 'hosts.id','hosts.dns_hostname')
>
> I'm unable to print the table transmissions resolving the foreign keys
> src and dst.
> Somebody can help me?
> thanks in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---