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


Python DBSession.order_by方法代码示例

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


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

示例1: get_log_entries

# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import order_by [as 别名]
 def get_log_entries(tank_id=None, timerange=None):
     """ Get a list of LogEntry objects """
     query = DBSession().query(LogEntry)
     if tank_id is not None:
         query = query.filter(LogEntry.tank_id == tank_id)
     if timerange is not None:
         if 'start' in timerange:
             query = query.filter(LogEntry.entry_time >= timerange['start'])
         if 'end' in timerange:
             query = query.filter(LogEntry.entry_time <= timerange['end'])
     return query.order_by(LogEntry.entry_time.asc()).all()
开发者ID:csammis,项目名称:reef,代码行数:13,代码来源:EventManager.py

示例2: get_measurements

# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import order_by [as 别名]
 def get_measurements(tank_id=None, parameters=None, timerange=None):
     """ Get a list of Measurements """
     query = DBSession().query(Measurement)
     if tank_id is not None:
         query = query.filter(Measurement.tank_id == tank_id)
     if parameters is not None:
         query = query.filter(Measurement.measurement_type_id.in_(parameters))
     if timerange is not None:
         if 'start' in timerange:
             query = query.filter(Measurement.measurement_time >= timerange['start'])
         if 'end' in timerange:
             query = query.filter(Measurement.measurement_time <= timerange['end'])
     return query.order_by(Measurement.measurement_time.asc()).all()
开发者ID:csammis,项目名称:reef,代码行数:15,代码来源:EventManager.py

示例3: get_tanks

# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import order_by [as 别名]
 def get_tanks():
     """ Get a list of all Tanks """
     query = DBSession().query(Tank)
     return query.order_by(Tank.name.asc()).all()
开发者ID:csammis,项目名称:reef,代码行数:6,代码来源:ConfigManager.py

示例4: get_scheduled_events

# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import order_by [as 别名]
 def get_scheduled_events(tank_id):
     """ Get a list of ScheduledEvents by tank ID """
     query = DBSession().query(ScheduledEvent).filter(ScheduledEvent.tank_id == tank_id)
     return query.order_by(ScheduledEvent.event_name.asc()).all()
开发者ID:csammis,项目名称:reef,代码行数:6,代码来源:ConfigManager.py

示例5: get_measurement_types

# 需要导入模块: from models import DBSession [as 别名]
# 或者: from models.DBSession import order_by [as 别名]
 def get_measurement_types():
     """ Get a list of all MeasurementTypes """
     query = DBSession().query(MeasurementType)
     return query.order_by(MeasurementType.label.asc()).all()
开发者ID:csammis,项目名称:reef,代码行数:6,代码来源:ConfigManager.py


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