ThinkSQL like think-orm(ThinkPHP)
Project description
ThinkSQL 类似ThinkPHP的数据库引擎
安装
pip install think-sql
使用
1. simple demo
Database:
test
Table:user
from think-sql.database import DB
config = {
'database': 'test',
'host': '127.0.0.1',
'port': 3306,
'username': 'root',
'password': 'root',
}
with DB(**config) as db:
data = db.table('user').where('id',1).find()
print(data)
result
{
"id":1,
"username":"hbh112233abc",
"age":"36",
"address":"FUJIAN.XIAMEN"
}
开发
poetry
Python包管理之poetry的使用
# 配置虚拟环境在项目目录下
poetry config virtualenvs.path true
# 安装依赖
poetry install
# 进入虚拟环境
poetry shell
poetry命令
名称 | 功能 |
---|---|
new | 创建一个项目脚手架,包含基本结构、pyproject.toml 文件 |
init | 基于已有的项目代码创建 pyproject.toml 文件,支持交互式填写 |
install | 安装依赖库 |
update | 更新依赖库 |
add | 添加依赖库 |
remove | 移除依赖库 |
show | 查看具体依赖库信息,支持显示树形依赖链 |
build | 构建 tar.gz 或 wheel 包 |
publish | 发布到 PyPI |
run | 运行脚本和代码 |
单元测试
pytest --cov --cov-report=html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
think-sql-0.1.0.tar.gz
(12.1 kB
view hashes)
Built Distribution
think_sql-0.1.0-py3-none-any.whl
(12.3 kB
view hashes)
Close
Hashes for think_sql-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f57fa52520a2a15d0adc4be6b64c023ed490adfd2242936f8efb904d830089e8 |
|
MD5 | 888a1a896e935ed46083bccc3025ca77 |
|
BLAKE2b-256 | 903f009b398c45ea3042348cf411ebffbb0e6a77de060742565eea74467a3c3a |