一个通用数据库连接插件
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.1a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d23df8be57116081cafe9a847ac9ac48de4d190ebaf21822c20463fe5646ddf |
|
MD5 | 4ca604d7be1ed7c161ea5761620b81d7 |
|
BLAKE2b-256 | 23c5fd694cf02f9275941d9d825d18a961e748ff87d1f5df34130d07e17f7fcc |
Close
Hashes for nonebot_plugin_tortoise_orm-0.0.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c38aa0bb0447e157a4c81f4aca0bb90a7ec53db30163c56da740289b69ec2bc |
|
MD5 | 538bea51d3c422f470eddc49ebceddd9 |
|
BLAKE2b-256 | 4ccfe973c4b20eb78c670aa991569b93ca2179f84de17f0f0c89610bb186221b |