Engine

mysql 创建表 create table详解

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 4...

在SQLAlchemy ORM中动态变更表名

在开发过程中,经常会遇到几张表结构相同,仅仅表名不一样。这在直接使用SQL语句进行查询的环境中处理起来很简单,但如果使用了SQLAlchemy ORM之后,因在model定义时就确定了表名,就需要用其他方法进行表名的变更。 假定数据库中有两张表:user,user_1,下面用一个简单程序展示如何在查询时变更表名。  使用declarative_base定义...

数据库MySQL/Postgres/Redis异步操作

数据库异步操作 基于 aiomysql 异步操作mysql数据库     异步操作 MySQL 的话,需要使用一个 aiomysql,直接 pip install aiomysql 入门案例 # -*- coding: utf-8 -*- # 导入异步操作的工具类库 import asyncio import aiomysql.sa as aio_sa...