l.s.d.c.Collection(object) : class documentation

Part of lp.services.database.collection View In Hierarchy

Known subclasses: lp.translations.model.potemplate.TranslationTemplatesCollection

An arbitrary collection of database objects.

Works as a Storm wrapper: create a collection based on another collection, adding joins and select conditions to taste.

As in any Storm query, you can select any mix of classes and individual columns or other Storm expressions.

Method __init__ Construct a collection, possibly based on another one.
Method refine Return a copy of self with further restrictions, tables etc.
Method use Return a copy of this collection that uses the given store.
Method joinInner Convenience method: inner-join cls into the query.
Method joinOuter Outer-join cls into the query.
Method select Return a result set containing the requested values.
Method _parseTablesArg Turn tables argument into a list.
def __init__(self, *args, **kwargs):
Construct a collection, possibly based on another one.
ParametersbaseOptional collection that this collection is based on. The new collection will inherit its configuration.
conditionsOptional Storm select conditions, e.g. MyClass.attribute > 2.
classesA class, or tuple or list of classes, that should go into the "FROM" clause of the new collection. This need not include classes that are already in the base collection, or that are included as outer joins.
storeOptional: Storm Store to use.
def refine(self, *args, **kwargs):
Return a copy of self with further restrictions, tables etc.
def _parseTablesArg(self, tables):
Turn tables argument into a list.
ParameterstablesA class, or tuple of classes, or list of classes.
returnAll classes that were passed in, as a list.
def use(self, store):
Return a copy of this collection that uses the given store.
def joinInner(self, cls, *conditions):
Convenience method: inner-join cls into the query.

This is equivalent to creating a Collection based on this one but with cls and conditions added.

def joinOuter(self, cls, *conditions):
Outer-join cls into the query.
def select(self, *values):
Return a result set containing the requested values.

If no values are requested, this selects the type of object that the Collection is a collection of.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.