使用 .env 的数据库连接
Project description
说明
使用 .env 的数据库连接
用法
pip install myally_database
项目根目录创建 .env 文件
DB_USER=名
DB_PASSWORD=数据库密码
DB_HOST=ip
DB_PORT=端口
DB_DATABASE=数据库
调用后用法与包 SQLAlchemy 一致
from myally_database import database
# 获取数据库会话
session = database.get_session()
# 提交事务
session.commit()
# 关闭会话
session.close()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
myally_database-1.0.tar.gz
(1.6 kB
view hashes)
Built Distribution
Close
Hashes for myally_database-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23b57aefe1365a131d894aba7f44b7219c5e4c894e818aea8e6b3aa6a3694275 |
|
MD5 | 3fe1350e06321188e6433bf125f250ec |
|
BLAKE2b-256 | ac76030482d906aeb2bd47cd0fd04b833275374410c4015bf6a646f9a18261c5 |