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


Python DBSESSION.first方法代码示例

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


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

示例1: find_by_login

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import first [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

示例2: get_by_internal_id

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import first [as 别名]
    def get_by_internal_id(cls, internal_id):
        query = DBSESSION().query(cls.id).filter_by(internal_id=internal_id)
        query = query.first()

        if query is not None:
            result = query[0]
        else:
            result = None
        return result
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:11,代码来源:treasury_measures.py

示例3: get_next_order

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import first [as 别名]
 def get_next_order(cls):
     """
     :returns: The next available order
     :rtype: int
     """
     query = DBSESSION().query(func.max(cls.order)).filter_by(active=True)
     query = query.first()
     if query is not None and query[0] is not None:
         result = query[0] + 1
     else:
         result = 0
     return result
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:14,代码来源:income_statement_measures.py

示例4: get_next_order

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import first [as 别名]
 def get_next_order(cls):
     """
     :returns: The next available order
     :rtype: int
     """
     query = DBSESSION().query(func.max(cls.order)).filter_by(active=True)
     query = query.filter_by(
         type_=cls.__mapper_args__['polymorphic_identity']
     )
     query = query.first()
     if query is not None and query[0] is not None:
         result = query[0] + 1
     else:
         result = 0
     return result
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:17,代码来源:options.py

示例5: get_next_order_by_category

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import first [as 别名]
 def get_next_order_by_category(cls, category_id):
     """
     :param int category_id: The id of the category to check for
     :returns: The next order available in types from the given category
     :rtype: int
     """
     query = DBSESSION().query(func.max(cls.order)).filter_by(
         category_id=category_id
     ).filter_by(active=True)
     query = query.first()
     if query is not None and query[0] is not None:
         result = query[0] + 1
     else:
         result = 0
     return result
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:17,代码来源:income_statement_measures.py

示例6: last

# 需要导入模块: from autonomie_base.models.base import DBSESSION [as 别名]
# 或者: from autonomie_base.models.base.DBSESSION import first [as 别名]
 def last(cls, grid_class, company_id):
     query = DBSESSION().query(grid_class).filter_by(company_id=company_id)
     query = query.order_by(desc(grid_class.date))
     return query.first()
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:6,代码来源:services.py


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