Smart7_ORM
项目依赖
| 包名 | 版本 |
|---|---|
| tortoise-orm | ≥ 0.17.7 |
| aerich | ≥ 0.5.8 |
配置数据库
0x01 项目根目录配置settings.py
# mysql setting
database = {
"db": 'MySQL',
"host": "localhost",
"username": "hubert",
"password": "hubert",
"db_name": "test_table",
}
# PostgreSQL setting
database = {
"db": 'PostgreSQL',
"host": "localhost",
"username": "hubert",
"password": "hubert",
"db_name": "test_table",
}
# sqlite setting
database = {
"db": 'SQLite',
"db_name": "test_table.db",
}
0x02 自动获取模型所在包
from smart7_orm.utils import discover_models
model_list = discover_models()
0x03 数据库设置
from smart7_orm.core import make_sql
from smart7_orm.utils import discover_models
TORTOISE_ORM = {
"connections": {"default": make_sql().get_url()},
"apps": {
"models": {
"models": ["aerich.models", *discover_models()],
"default_connection": "default",
},
},
}
迁移数据库
0x01 初始化迁移配置
aerich init
0x02 初始化数据库
aerich init-db
0x03 更新模型并进行迁移
aerich migrate
0x04 升级到最新版本
aerich upgrade
0x05 降级到指定版本
aerich downgrade
0x06 显示历史
aerich history
0x06 显示要迁移的头
aerich heads
更多请查看 aerich github
Metadata
Release files for smart7-orm 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smart7_orm-1.0.4.tar.gz | 11.0 kB | Without provenance | Details for smart7_orm-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smart7_orm-1.0.4-py3.7.egg | Legacy Egg format | - | - | Details for smart7_orm-1.0.4-py3.7.egg |
Total release size: 31.1 kB
Release files / smart7_orm-1.0.4.tar.gz
| Download URL | smart7_orm-1.0.4.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c86e9599e9ff3fe13330f437aaaf5f749ff18cf2844bf1b14261897397ad965b
|
|
BLAKE2b-256 checksum How to use checksums |
3cee9c9339cbcadc368b8cc091e2f55486c806480891698d3864349d187c28c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.2
|
Release files / smart7_orm-1.0.4-py3.7.egg
| Download URL | smart7_orm-1.0.4-py3.7.egg |
|---|---|
| Size | 20.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
50dbe7ec905a693e59afb9ef4c66aef0bd7ea160710eefc0a7372b0ffc4bfbbf
|
|
BLAKE2b-256 checksum How to use checksums |
5fced11be3a6bf1a5e14e2205bef2e80e2749f6c31cb467c94b7c9f395a788a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.2
|
Security for smart7-orm 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.