本文整理汇总了Python中models.DBSession.count方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.count方法的具体用法?Python DBSession.count怎么用?Python DBSession.count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.DBSession
的用法示例。
在下文中一共展示了DBSession.count方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_log_entry
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import count [as 别名]
def get_log_entry(logentry_id):
""" Get a LogEntry by ID """
query = DBSession().query(LogEntry).filter(LogEntry.id == logentry_id)
if query.count() == 0:
return None
return query.first()
示例2: get_measurement
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import count [as 别名]
def get_measurement(measurement_id):
""" Get a Measurement by ID """
query = DBSession().query(Measurement).filter(Measurement.id == measurement_id)
if query.count() == 0:
return None
return query.first()
示例3: get_tank_from_name
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import count [as 别名]
def get_tank_from_name(tank_name):
""" Get a Tank by name """
query = DBSession().query(Tank).filter(Tank.name == tank_name)
if query.count() == 0:
return None
return query.first()
示例4: get_scheduled_event
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import count [as 别名]
def get_scheduled_event(event_id):
""" Get a ScheduledEvent by ID """
query = DBSession().query(ScheduledEvent).filter(ScheduledEvent.id == event_id)
if query.count() == 0:
return None
return query.first()
示例5: get_tank
# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import count [as 别名]
def get_tank(tank_id):
""" Get a Tank by ID """
query = DBSession().query(Tank).filter(Tank.id == tank_id)
if query.count() == 0:
return None
return query.first()