上一页 1 2 3 4 5 6 7 8 ··· 21 下一页

2020年4月10日

python验证身份证

摘要: _natual_id_weight = (7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2) def _is_natural_id_valid(oid: str) -> bool: if not isinstance(oid, str) or l 阅读全文

posted @ 2020-04-10 15:37 不要挡着我晒太阳 阅读(601) 评论(0) 推荐(0) 编辑

sqlalchemy的op函数:

摘要: 源码: def op(self, opstring, precedence=0, is_comparison=False): """produce a generic operator function. e.g.:: somecolumn.op("*")(5) produces:: somecol 阅读全文

posted @ 2020-04-10 14:20 不要挡着我晒太阳 阅读(901) 评论(0) 推荐(0) 编辑

flask开发小结

摘要: 最简单的hello world #!/usr/bin/env python # encoding: utf-8 from flask import Flask app = Flask(__name__) @app.route('/') def index(): return 'hello world 阅读全文

posted @ 2020-04-10 11:06 不要挡着我晒太阳 阅读(209) 评论(0) 推荐(0) 编辑

2020年4月9日

Flask 异步化

摘要: web网站包含前端和后端, 异步处理可以用在前端, 也可以用在后端. 前端 jquery 进行 ajax 请求时, 可设置 async 属性为 true, 并为 success 设置一个 callback 函数, 在服务端返回之前, 浏览器可以执行 ajax 之后的代码, 当服务器端返回后, jqu 阅读全文

posted @ 2020-04-09 10:52 不要挡着我晒太阳 阅读(2173) 评论(0) 推荐(0) 编辑

SqlAlchemy汇总

摘要: 转载:https://www.cnblogs.com/harrychinese/archive/2012/09/12/My_Own_Tutorial_For_SqlAlchemy.html 使用 sqlalchemy 有3种方式:方式1, 使用raw sql;方式2, 使用SqlAlchemy的sq 阅读全文

posted @ 2020-04-09 10:36 不要挡着我晒太阳 阅读(3843) 评论(0) 推荐(0) 编辑

2020年4月8日

python @cached_property缓存装饰器

摘要: 源码:class cached_property(object): """ Decorator that converts a method with a single self argument into a property cached on the instance. Optional `` 阅读全文

posted @ 2020-04-08 17:05 不要挡着我晒太阳 阅读(816) 评论(0) 推荐(0) 编辑

sqlalchemy text() 函数

摘要: 作用:封装sql字符串 1. 不同数据库, 可以使用统一的sql参数传递写法. 参数须以:号引出. 在调用execute()的时候, 使用dict结构将实参传进去. from sqlalchemy import text result = db.execute(text('select * from 阅读全文

posted @ 2020-04-08 16:29 不要挡着我晒太阳 阅读(6722) 评论(0) 推荐(0) 编辑

理解SQLAlchemy的表继承关系(4)--高级应用

摘要: class Entry(AbstractConcreteBase, db.Model): """Base Class of Entry.""" id = db.Column(db.Integer, primary_key=True, nullable=False) created = db.Colu 阅读全文

posted @ 2020-04-08 13:58 不要挡着我晒太阳 阅读(301) 评论(0) 推荐(0) 编辑

理解SQLAlchemy的表继承关系(3)-Concrete Table Inheritance

摘要: Concrete Table Inheritance译成混合继承? 这种继承方式会创建一个ORM基类,然后在所有继承表中会创建包含ORM基类定义的字段的独立的表。 继承表与ORM基类的关系在数据库层面上没有外健关系,只是在语言层会有继承关系。 class Employee(AbstractConcr 阅读全文

posted @ 2020-04-08 13:57 不要挡着我晒太阳 阅读(343) 评论(0) 推荐(0) 编辑

理解SQLAlchemy的表继承关系(2)-Single Table Inheritance

摘要: Single Table Inheritance即单表继承,顾名思义,所有继承表的数据均保存在一个表。 该种继承比较容易理解。 class Employee(Base): __tablename__ = 'employee' id = Column(Integer, primary_key=True 阅读全文

posted @ 2020-04-08 11:53 不要挡着我晒太阳 阅读(423) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 21 下一页

导航