コード例 #1
0
ファイル: querying.py プロジェクト: b8va/everest
 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
コード例 #2
0
ファイル: querying.py プロジェクト: helixyte/everest
 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
コード例 #3
0
ファイル: scm_query.py プロジェクト: jgbarah/grimoire-api
    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)
コード例 #4
0
ファイル: common.py プロジェクト: VizGrimoire/GrimoireLib
    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)
コード例 #5
0
ファイル: scm_query.py プロジェクト: virusu/PFC_old
    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)
コード例 #6
0
ファイル: dynamic.py プロジェクト: yyul2001/geeknote
    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
コード例 #7
0
ファイル: dynamic.py プロジェクト: dreamwave/rad
    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
コード例 #8
0
ファイル: stm_old.py プロジェクト: motor23/sa_public_query
 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
コード例 #9
0
 def __init__(self, entities, engine):
     Query.__init__(self,
                    entities=entities,
                    session=sessionmaker(bind=engine)())
コード例 #10
0
 def __init__(self, attr, state):
     Query.__init__(self, attr.target_mapper, None)
     self.instance = state.obj()
     self.attr = attr
コード例 #11
0
 def __init__(self, regions, *args, **kw):
     self.cache_regions = regions
     Query.__init__(self, *args, **kw)
コード例 #12
0
 def __init__(self, manager, *args, **kw):
     self.cache_manager = manager
     Query.__init__(self, *args, **kw)
コード例 #13
0
ファイル: caching_query.py プロジェクト: lmamsen/rhodecode
 def __init__(self, manager, *args, **kw):
     self.cache_manager = manager
     Query.__init__(self, *args, **kw)
コード例 #14
0
ファイル: models.py プロジェクト: sergelab/flask-multilang
 def __init__(self, model, *args, **kwargs):
     self.model = model
     Query.__init__(self, *args, **kwargs)
コード例 #15
0
ファイル: caching_query.py プロジェクト: virtusize/nap
 def __init__(self, *args, **kw):
     Query.__init__(self, *args, **kw)
コード例 #16
0
 def __init__(self, regions, *args, **kw):
     self.cache_regions = regions
     Query.__init__(self, *args, **kw)
コード例 #17
0
ファイル: mango.py プロジェクト: ianmackinnon/mango
 def __init__(self, entities, session=None):
     Query.__init__(self, entities, session)
     self._retry = retry
コード例 #18
0
ファイル: __init__.py プロジェクト: vishalvishw10/pylonshq
 def __init__(self, *args, **kw):
     Query.__init__(self, *args, **kw)
コード例 #19
0
 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)
コード例 #20
0
 def __init__(self, *args, **kw):
     self.cache_regions = CACHE_REGIONS
     Query.__init__(self, *args, **kw)