1.models.py中添加该方法,可通过该方法转dict
#驼峰
def to_hump_dict(self):
return {commonUtils.str2Hump(c.name): getattr(self, c.name, None) for c in self.__table__.columns}
def to_dict(self):
return {c.name: getattr(self, c.name, None) for c in self.__table__.columns}
Base.to_hump_dict = to_hump_dict
Base.to_dict = to_dict
class User(Base):
__tablename__ = 'key_user' id = Column(INTEGER(11), primary_key=True, nullable=False, index=True)
uid = Column(String(32), primary_key=True, nullable=False)
username = Column(String(255), primary_key=True, nullable=False, index=True)
remarks = Column(String(255))
creater = Column(String(255))
create_time = Column(TIMESTAMP)
2.查询(入参没有的情况)、分页、排序
  
if username:
  q = self.dbsession.query(KeyUser).filter(User.username == username)
if passwd:
  q = q.filter(User.passwd== passwd)
q.limit(pageSize).offset(int(page-1)*pageSize).order_by(User.id.desc()).all() 3.使用timestamp类型时,对应的python获取
  
func.current_timestamp()

最新文章

  1. 使用 RequireJS 优化 Web 应用前端
  2. 增强拉格朗日乘子法(Augmented Lagrange Method)
  3. linux下的vim使用教程
  4. win系统下nodejs安装及环境配置
  5. Hashtable、Dictionary和List 谁效率更高
  6. 【poj2891-Strange Way to Express Integers】拓展欧几里得-同余方程组
  7. 【python】 入门 搭建环境
  8. object-c 入门基础篇
  9. mysql数据库操作语句大全
  10. Codeforces 463D Gargari and Permutations
  11. Oracle事物基础
  12. FlexiGrid使用手册
  13. memcached常用命令
  14. Tensorflow小技巧整理:修改张量特定元素的值
  15. Sublime text3所遇到的问题
  16. MySQL物理备份 lvm-snapshot
  17. Java学习——方法
  18. vue组件推荐
  19. linux E325: 注意 发现交换文件 "*.swp" 解决方法
  20. linux测试环境搭建步骤

热门文章

  1. java对集合的操作,jxl操作excel
  2. 搜狗浏览器特性页面JS
  3. 微服务SpringCloud+Docker入门到高级实战(目录)
  4. elasticsearch 7 安装
  5. 学习python第二天 流程判断
  6. HDU - 1973 - Prime Path (BFS)
  7. angularjs的使用技巧
  8. Diycode开源项目 NotificationActivity
  9. Java文件 ---流
  10. easyui的tree基本属性