## 安装`mysqlchain`
本扩展包可以通过`pip`或`pip3`来安装
```
pip install mysqlchain
```
## 导入扩展包并初始化模块
~~~
from mysqlchain import chain
config = {
'host': 'localhost',
'port': 3306,
'user': 'root',
'password': '123456',
'database': 'testdata',
'charset': 'utf8'
}
db = chain(config)
~~~
>[danger] 实例化模块,并传入`config`字典参数,其中`user、password、database`为必传项,否则无法连接数据库
- 连接数据库
- 链式操作方法
- distinct
- field
- withoutField
- name
- alias
- force
- join
- leftJoin
- rightJoin
- union
- unionAll
- where
- whereOr
- whereTime
- whereBetweenTime
- whereNotBetweenTime
- whereBetweenTimeField
- whereNotBetweenTimeField
- whereYear
- whereMonth
- whereWeek
- whereDay
- group
- having
- order
- orderRand
- limit
- page
- lock
- comment
- ignore
- inc
- dec
- fetchSql
- 查询数据
- 聚合查询
- 新增数据
- 更新数据
- 删除数据
- 原生操作