def __init__(self, entities, session, **kw): SaQuery.__init__(self, entities, session, **kw) ent_cls = entities[0] if isinstance(ent_cls, type) and issubclass(ent_cls, Entity): self._entity_class = ent_cls else: self._entity_class = None
def __init__(self, entities, session, **kw): SaQuery.__init__(self, entities, session, **kw) ent_cls = entities[0] if isinstance(ent_cls, type) and issubclass(ent_cls, Entity): self._entity_class = ent_cls else: # just for compatibility pragma: no cover self._entity_class = None
def __init__ (self, entities, session): """Create an SCMQuery. Parameters ---------- entities: session: Attributes ---------- self.start: datetime.datetime Start of the period to consider for commits. Default: None (start from the first commit) self.end: datetime.datetime End of the period to consider for commits. Default: None (end in the last commit) """ self.start = None self.end = None # Keep an accounting of which tables have been joined, to avoid # undesired repeated joins self.joined = [] Query.__init__(self, entities, session)
def __init__ (self, entities, session): """Create a GrimoreQuery. Parameters ---------- entities: list of SQLAlchemy entities Entities (tables) to include in the query session: SQLAlchemy session SQLAlchemy session to use to connect to the database Attributes ---------- self.start: datetime.datetime Start of the period to consider for commits. Default: None (start from the first commit) self.end: datetime.datetime End of the period to consider for commits. Default: None (end in the last commit) """ self.start = None self.end = None # Keep an accounting of which tables have been joined, to avoid # undesired repeated joins self.joined = [] Query.__init__(self, entities, session)
def __init__ (self, entities, session): """Initialize the object self.start and self.end will be used in case there are temporal limits for the query (useful to produce TimeSeries objects, which needs those. """ self.start = None self.end = None Query.__init__(self, entities, session)
def __init__(self, attr, state): Query.__init__(self, attr.target_mapper, None) self.instance = instance = state.obj() self.attr = attr mapper = object_mapper(instance) prop = mapper._props[self.attr.key] self._criterion = prop.compare(operators.eq, instance, value_is_parent=True, alias_secondary=False) if self.attr.order_by: self._order_by = self.attr.order_by
def __init__(self, attr, state): Query.__init__(self, attr.target_mapper, None) self.instance = instance = state.obj() self.attr = attr mapper = object_mapper(instance) prop = mapper.get_property(self.attr.key, resolve_synonyms=True) self._criterion = prop.compare( operators.eq, instance, value_is_parent=True, alias_secondary=False) if self.attr.order_by: self._order_by = self.attr.order_by
def __init__(self, entities, *args, **kwargs): Query.__init__(self, entities, *args, **kwargs) for entity in entities: if hasattr(entity, 'parententity'): entity = entity.parententity try: cls = _class_to_mapper(entity).class_ except AttributeError: # XXX For tables, table columns pass else: crit = getattr(cls, 'public', None) if crit is not None: if not isinstance(crit, ClauseElement): # This simplest safe way to make bare boolean column # accepted as expression. crit = cast(crit, Boolean) query = self.filter(crit) self._criterion = query._criterion
def __init__(self, entities, engine): Query.__init__(self, entities=entities, session=sessionmaker(bind=engine)())
def __init__(self, attr, state): Query.__init__(self, attr.target_mapper, None) self.instance = state.obj() self.attr = attr
def __init__(self, regions, *args, **kw): self.cache_regions = regions Query.__init__(self, *args, **kw)
def __init__(self, manager, *args, **kw): self.cache_manager = manager Query.__init__(self, *args, **kw)
def __init__(self, model, *args, **kwargs): self.model = model Query.__init__(self, *args, **kwargs)
def __init__(self, *args, **kw): Query.__init__(self, *args, **kw)
def __init__(self, entities, session=None): Query.__init__(self, entities, session) self._retry = retry
def __init__(self, regions, *args, **kw): self.cache_regions = regions self.fetched_from_cache = False self.format_log_sql = kw.pop("format_log_sql", True) Query.__init__(self, *args, **kw)
def __init__(self, *args, **kw): self.cache_regions = CACHE_REGIONS Query.__init__(self, *args, **kw)