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

Method __init__

pattern/db/__init__.py:1178–1196  ·  view source on GitHub ↗

A selection of rows from the given table, filtered by any() and all() constraints.

(self, table, fields=ALL, filters=[], relations=[], sort=None, order=ASCENDING, group=None, function=FIRST, range=None)

Source from the content-addressed store, hash-verified

1176 id, cache = 0, {}
1177
1178 def __init__(self, table, fields=ALL, filters=[], relations=[], sort=None, order=ASCENDING, group=None, function=FIRST, range=None):
1179 """ A selection of rows from the given table, filtered by any() and all() constraints.
1180 """
1181 # Table.search(ALL, filters=any(("type","cat"), ("type","dog")) => cats and dogs.
1182 # Table.search(("type", "name")), group="type", function=COUNT) => all types + amount per type.
1183 # Table.search(("name", "types.has_tail"), relations=[("types","type","id")]) => links type to types.id.
1184 Query.id += 1
1185 filters = Group(*filters, **dict(operator=isinstance(filters, Group) and filters.operator or AND))
1186 self._id = Query.id
1187 self._table = table
1188 self.fields = fields # A field name, list of field names or ALL.
1189 self.aliases = {} # A dictionary of field name aliases, used with Query.xml or Query-in-Query.
1190 self.filters = filters # A group of filter() objects.
1191 self.relations = relations # A list of relation() objects.
1192 self.sort = sort # A field name, list of field names or field index for sorting.
1193 self.order = order # ASCENDING or DESCENDING.
1194 self.group = group # A field name, list of field names or field index for folding.
1195 self.function = function # FIRST, LAST, COUNT, MAX, MIN, SUM, AVG, STDEV or CONCATENATE (or list).
1196 self.range = range # A (index1, index2)-tuple. The first row in the table is 0.
1197
1198 @property
1199 def table(self):

Callers

nothing calls this directly

Calls 1

GroupClass · 0.70

Tested by

no test coverage detected