当前位置: 首页>>代码示例>>Python>>正文


Python DBSESSION.options方法代码示例

本文整理汇总了Python中autonomie_base.models.base.DBSESSION.options方法的典型用法代码示例。如果您正苦于以下问题:Python DBSESSION.options方法的具体用法?Python DBSESSION.options怎么用?Python DBSESSION.options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在autonomie_base.models.base.DBSESSION的用法示例。


在下文中一共展示了DBSESSION.options方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_types

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import options [as 别名]
 def get_types(cls, active=True, keys=()):
     query = DBSESSION().query(cls)
     if keys:
         query = query.options(load_only(*keys))
     if active:
         query = query.filter_by(active=True)
     return query
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:9,代码来源:income_statement_measures.py

示例2: find_by_login

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import options [as 别名]
 def find_by_login(cls, login, active=True):
     query = DBSESSION().query(cls)
     query = query.options(load_only('pwd_hash'))
     query = query.filter_by(login=login)
     if active:
         query = query.filter_by(active=True)
     return query.first()
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:9,代码来源:login.py

示例3: query

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import options [as 别名]
 def query(self):
     query = DBSESSION().query(Task)
     query = query.with_polymorphic([Invoice, CancelInvoice])
     query = query.outerjoin(Invoice.payments)
     query = query.outerjoin(Task.customer)
     query = query.outerjoin(Task.company)
     query = query.options(
         contains_eager(Invoice.payments).load_only(
             Payment.id, Payment.date, Payment.mode
         )
     )
     query = query.options(
         contains_eager(Task.customer).load_only(
             Customer.name, Customer.code, Customer.id,
             Customer.firstname, Customer.lastname, Customer.civilite,
             Customer.type_,
         )
     )
     query = query.options(
         contains_eager(Task.company).load_only(
             Company.name,
             Company.id,
         )
     )
     query = query.options(
         load_only(
             "_acl",
             "name",
             "date",
             "id",
             "ht",
             "tva",
             "ttc",
             "company_id",
             "customer_id",
             "official_number",
             "internal_number",
             "status",
             Invoice.paid_status,
         )
     )
     return query
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:44,代码来源:lists.py

示例4: get_categories

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import options [as 别名]
 def get_categories(cls, active=True, keys=()):
     """
     :param bool active: Only load active categories
     :param tuple keys: The keys to load (list of str)
     :returns: IncomeStatementMeasureTypeCategory ordered by order key
     :rtype: list
     """
     query = DBSESSION().query(cls)
     if keys:
         query = query.options(load_only(*keys))
     query = query.filter_by(active=active).order_by(cls.order)
     return query.all()
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:14,代码来源:income_statement_measures.py

示例5: get_by_category

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import options [as 别名]
    def get_by_category(cls, category_id, key=None):
        """
        Collect IncomeStatementMeasureType associated to the given category

        :param int category_id: The id to check for
        :param str key: The key to load (if we want to restrict the query
        :rtype: list
        """
        query = DBSESSION().query(cls)
        if key is not None:
            query = query.options(load_only(key))
        query = query.filter_by(category_id=category_id)
        return query.all()
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:15,代码来源:income_statement_measures.py

示例6: get_customer_codes_and_names

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import options [as 别名]
 def get_customer_codes_and_names(cls, company):
     """
     Return a query for code and names of customers related to company
     :param company: the company we're working on
     :returns: an orm query loading Customer instances with only the columns
     we want
     :rtype: A Sqlalchemy query object
     """
     from autonomie.models.customer import Customer
     query = DBSESSION().query(Customer)
     query = query.options(load_only('code', 'name'))
     query = query.filter(Customer.code != None)
     query = query.filter(Customer.company_id == company.id)
     return query.order_by(Customer.code)
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:16,代码来源:company.py


注:本文中的autonomie_base.models.base.DBSESSION.options方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。