cyborg/db/sqlalchemy/api.py
def model_query(context, model, *args, **kwargs):
    """Query helper for simpler session usage.

    :param context: Context of the query
    :param model: Model to query. Must be a subclass of ModelBase.
    :param args: Arguments to query. If None - model is used.

    Keyword arguments:

    :keyword project_only:
      If set to True, then will do query filter with context's project_id.
      if set to False or absent, then will not do query filter with context's
      project_id.
    :type project_only: bool
    """

    if kwargs.pop("project_only", False):
        kwargs["project_id"] = context.tenant

    with _session_for_read() as session:
        query = sqlalchemyutils.model_query(
            model, session, args, **kwargs)
        return query
Query helper for simpler session usage.

    :param context: Context of the query
    :param model: Model to query. Must be a subclass of ModelBase.
    :param args: Arguments to query. If None - model is used.

    Keyword arguments:

    :keyword project_only:
      If set to True, then will do query filter with context's project_id.
      if set to False or absent, then will not do query filter with context's
      project_id.
    :type project_only: bool
    
Query helper for simpler session usage.
Query helper for simpler session usage .
def model_query(context, model, *args, **kwargs):
    if kwargs.pop("project_only", False):
        kwargs["project_id"] = context.tenant
    with _session_for_read() as session:
        query = sqlalchemyutils.model_query(
            model, session, args, **kwargs)
        return query
def model_query ( context , model , * args , ** kwargs ) : if kwargs . pop ( "project_only" , False ) : kwargs [ "project_id" ] = context . tenant with _session_for_read ( ) as session : query = sqlalchemyutils . model_query ( model , session , args , ** kwargs ) return query
Query helper for simpler session usage.
Query helper for simpler session usage .
"""Query helper for simpler session usage.

    :param context: Context of the query
    :param model: Model to query. Must be a subclass of ModelBase.
    :param args: Arguments to query. If None - model is used.

    Keyword arguments:

    :keyword project_only:
      If set to True, then will do query filter with context's project_id.
      if set to False or absent, then will not do query filter with context's
      project_id.
    :type project_only: bool
    """
context
Context of the query
Context of the query
model
Model to query. Must be a subclass of ModelBase.
Model to query . Must be a subclass of ModelBase .
args
Arguments to query. If None - model is used.
Keyword arguments.
Arguments to query . If None - model is used . Keyword arguments .
project_only
If set to True, then will do query filter with context's project_id.
if set to False or absent, then will not do query filter with context's
project_id.
If set to True then will do query filter with context ' s project_id . if set to False or absent then will not do query filter with context ' s project_id .