一个通用数据库连接插件
Project description
通用 ORM 数据库连接插件
施工中。。。
- 参考 example_bot 来创建一个 聊天记录 插件吧~!
.env
设置
参考配置:
# db_url=postgres://postgres@localhost:5432/postgres
db_url=sqlite://db.sqlite3
db_generate_schemas=false
db_url
使用 sqlite
直接使用相对路径来建立
db_url=sqlite://db.sqlite3
如果时指定路径,则应该是
db_url=sqlite:///data/db.sqlite
使用绝对路径 注意有三个 /
使用 PostgreSQL
db_url=postgres://postgres:pass@db.host:5432/somedb
- 说明:
postgres://
表示协议 postgres:pass@
表示登入账号和密码 如果没有密码则用postgres@
db.host:5432
表示数据库的地址 和 端口 如果是本机 则为localhost:5432
/somedb
表示数据库名
使用 MySQL/MariaDB
db_url=mysql://myuser:mypass:pass@db.host:3306/somedb
跟上面的差不多
db_generate_schemas
- 填入
true
或false
- 默认
false
- 如为
true
则会在每次启动时,在空的数据库上初始化数据表- 请在第一次启动或有新数据表时设置为
true
来初始化表,随后设置为false
关闭该功能
- 请在第一次启动或有新数据表时设置为
数据库类型
- postgres
- sqlite
- MySQL/MariaDB
其他待补充
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
Built Distribution
Close
Hashes for nonebot-plugin-tortoise-orm-0.0.1a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2edd8185fc709498803294aeb7cf3158d502d6e7acac8f78943a98b12b106eb |
|
MD5 | 16d3d46a24964d8342a02dc5cc4839c2 |
|
BLAKE2b-256 | cb7df5cb924e3660806f8551313bdf816092e331d1f162a0c76c70b03654799a |
Close
Hashes for nonebot_plugin_tortoise_orm-0.0.1a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4b38cf34d91fc0f6498016678ac82a73a4c82532f7e0f11545fe617b52caac3 |
|
MD5 | be9cd8efc529894c8c7a79d53a331a6f |
|
BLAKE2b-256 | dc0b9affded6506feec4de51291a05be258ae888d47ca3257ced3fcf2e07e210 |