def test(): i = 0 for user in DbInstance(SQLAlchemy(app)).get_rows(User): if i > 5: break print(user.name) time.sleep(1) i += 1
#!/usr/bin/env python # encoding: utf-8 """ @author: zhanghe @software: PyCharm @file: api.py @time: 2019-05-07 11:17 """ import datetime from libs.db_orm_pk import DbInstance from apps.databases.db_target import target_db from apps.models.db_target import Delivery db_instance = DbInstance(target_db) def get_delivery_row_by_id(delivery_id): """ 通过 id 获取信息 :param delivery_id: :return: None/object """ return db_instance.get_row_by_id(Delivery, delivery_id) def get_delivery_row(*args, **kwargs): """ 获取信息 :param args:
# encoding: utf-8 """ @author: zhanghe @software: PyCharm @file: api.py @time: 2019-09-27 11:30 """ import datetime from apps.databases.db_lims import db_lims from apps.maps.status_delete import STATUS_DEL_OK from apps.models.model_lims import Analyze from libs.db_orm_pk import DbInstance db_instance = DbInstance(db_lims) def get_analyze_row_by_id(analyze_id): """ 通过 id 获取信息 :param analyze_id: :return: None/object """ return db_instance.get_row_by_id(Analyze, analyze_id) def get_analyze_row(*args, **kwargs): """ 获取信息 :param args: