Skip to main content

xiaoapi sqlalchemy

Project description

xiaoapi-sqlalchemy

xiaoapi的sqlalchemy扩展包

安装

pip install xiaoapi-sqlalchemy

配置数据库连接url

在 application/settings 中 配置数据库连接url

# 数据库配置项
# 连接引擎官方文档:https://docs.sqlalchemy.org/en/20/core/engines.html
# mysql配置说明:mysql+asyncmy://数据库用户名:数据库密码@数据库地址:数据库端口/数据库名称,需安装asyncmy
# sqlite配置说明:sqlite+aiosqlite:///数据库路径,需安装aiosqlite
SQLALCHEMY_DATABASE_URL = f"sqlite+aiosqlite:///{BASE_DIR}/db.sqlite3"

创建表结构

在 application/settings 中 配置需要迁移的models

# 数据库迁移
# 会将MIGRATE_MODELS里所有的model迁移到数据库表结构
MIGRATE_MODELS = [
    "modules.quickstart.models"
]

在命令行中使用以下命令创建表结构:

python manage.py sqlalchemy create-tables

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

xiaoapi-sqlalchemy-0.0.5.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

xiaoapi_sqlalchemy-0.0.5-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file xiaoapi-sqlalchemy-0.0.5.tar.gz.

File metadata

  • Download URL: xiaoapi-sqlalchemy-0.0.5.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.10

File hashes

Hashes for xiaoapi-sqlalchemy-0.0.5.tar.gz
Algorithm Hash digest
SHA256 335346a67fe57582c8e5176c6c5bb0e301a4e2b634f2b87eec193895646fda91
MD5 e02985ce209b8c24c10181345cc0b7a7
BLAKE2b-256 95314708faac7d6be3c8ea51f0dcddd9d3b53ad967e16816d17b72376e7defe1

See more details on using hashes here.

File details

Details for the file xiaoapi_sqlalchemy-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for xiaoapi_sqlalchemy-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b8a0da5aedfbebcc86c311da7596b0066e9f9124752ca5106e7a9df26be2bd31
MD5 832a69466267460199bc97781af8e625
BLAKE2b-256 8b494986f4e1112365230b8e5cbbbed4f8dfdc596f223b5568a29f7d45c8336f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page