MCPcopy Index your code
hub / github.com/clips/pattern / link

Method link

pattern/db/__init__.py:638–647  ·  view source on GitHub ↗

Defines a relation between two tables in the database. When executing a table query, fields from the linked table will also be available (to disambiguate between field names, use table.field_name).

(self, table1, field1, table2, field2, join="left")

Source from the content-addressed store, hash-verified

636 remove = drop
637
638 def link(self, table1, field1, table2, field2, join="left"):
639 """ Defines a relation between two tables in the database.
640 When executing a table query, fields from the linked table will also be available
641 (to disambiguate between field names, use table.field_name).
642 """
643 if isinstance(table1, Table):
644 table1 = table1.name
645 if isinstance(table2, Table):
646 table2 = table2.name
647 self.relations.append((table1, field1, table2, field2, join))
648
649 def __repr__(self):
650 return "Database(name=%s, host=%s, tables=%s)" % (

Callers 2

test_queryMethod · 0.80
test_xmlMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by 2

test_queryMethod · 0.64
test_xmlMethod · 0.64