Good Morning, With this line of code, do I get the records of the tables referenced in table A? My question is as follows, I have two tables, A and B, I want to check which records in table A, have some record in the table referenced this record of A hug
2016-11-26 11:33 GMT-02:00 Anthony <abasta...@gmail.com>: > Not sure I understand exactly, but if you want to know whether tableA is > referenced by any other tables, you can do something like: > > tableA_referenced_by = set(field._table for field in db.tableA. > _referenced_by) > > That will give you a set of any tables (the actual DAL Table objects) that > have fields referencing tableA (note, I used set() in order to de-duplicate > in case a given table has more than one field referencing tableA). > > Anthony > > > On Friday, November 25, 2016 at 11:11:41 PM UTC-5, Áureo Dias Neto wrote: >> >> Hello guys, >> >> I'm making a search form, and i need to verify, if, a table is referenced >> in another table, that's two have a relationship one-to-many. >> >> My asking is, i'm make it with a for loop, and it's return a maximum >> recursion of python objet.. >> >> How to dow, a search, in all the table, to check, if this table have any >> register on another table, that's refere to this first table? >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.