xiaoapi-sqlalchemy


Namexiaoapi-sqlalchemy JSON
Version 0.0.5 PyPI version JSON
download
home_pageNone
Summaryxiaoapi sqlalchemy
upload_time2024-03-29 02:02:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords xiaoapi fastapi web-framework sqlalchemy
VCS
bugtrack_url
requirements fastapi uvicorn typer loguru orjson SQLAlchemy asyncmy aiosqlite
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # xiaoapi-sqlalchemy
[xiaoapi](https://github.com/xiaojinlii/xiaoapi)的sqlalchemy扩展包


## 安装
```
pip install xiaoapi-sqlalchemy
```


## 配置数据库连接url
在 application/settings 中 配置数据库连接url
```python
# 数据库配置项
# 连接引擎官方文档: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
```python
# 数据库迁移
# 会将MIGRATE_MODELS里所有的model迁移到数据库表结构
MIGRATE_MODELS = [
    "modules.quickstart.models"
]
```

在命令行中使用以下命令创建表结构:
```
python manage.py sqlalchemy create-tables
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xiaoapi-sqlalchemy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "xiaoapi, fastapi, web-framework, sqlalchemy",
    "author": null,
    "author_email": "xiaojinli <553555614@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/95/31/4708faac7d6be3c8ea51f0dcddd9d3b53ad967e16816d17b72376e7defe1/xiaoapi-sqlalchemy-0.0.5.tar.gz",
    "platform": null,
    "description": "# xiaoapi-sqlalchemy\r\n[xiaoapi](https://github.com/xiaojinlii/xiaoapi)\u7684sqlalchemy\u6269\u5c55\u5305\r\n\r\n\r\n## \u5b89\u88c5\r\n```\r\npip install xiaoapi-sqlalchemy\r\n```\r\n\r\n\r\n## \u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5url\r\n\u5728 application/settings \u4e2d \u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5url\r\n```python\r\n# \u6570\u636e\u5e93\u914d\u7f6e\u9879\r\n# \u8fde\u63a5\u5f15\u64ce\u5b98\u65b9\u6587\u6863\uff1ahttps://docs.sqlalchemy.org/en/20/core/engines.html\r\n# mysql\u914d\u7f6e\u8bf4\u660e\uff1amysql+asyncmy://\u6570\u636e\u5e93\u7528\u6237\u540d:\u6570\u636e\u5e93\u5bc6\u7801@\u6570\u636e\u5e93\u5730\u5740:\u6570\u636e\u5e93\u7aef\u53e3/\u6570\u636e\u5e93\u540d\u79f0\uff0c\u9700\u5b89\u88c5asyncmy\r\n# sqlite\u914d\u7f6e\u8bf4\u660e\uff1asqlite+aiosqlite:///\u6570\u636e\u5e93\u8def\u5f84\uff0c\u9700\u5b89\u88c5aiosqlite\r\nSQLALCHEMY_DATABASE_URL = f\"sqlite+aiosqlite:///{BASE_DIR}/db.sqlite3\"\r\n```\r\n\r\n\r\n## \u521b\u5efa\u8868\u7ed3\u6784\r\n\u5728 application/settings \u4e2d \u914d\u7f6e\u9700\u8981\u8fc1\u79fb\u7684models\r\n```python\r\n# \u6570\u636e\u5e93\u8fc1\u79fb\r\n# \u4f1a\u5c06MIGRATE_MODELS\u91cc\u6240\u6709\u7684model\u8fc1\u79fb\u5230\u6570\u636e\u5e93\u8868\u7ed3\u6784\r\nMIGRATE_MODELS = [\r\n    \"modules.quickstart.models\"\r\n]\r\n```\r\n\r\n\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u8868\u7ed3\u6784:\r\n```\r\npython manage.py sqlalchemy create-tables\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "xiaoapi sqlalchemy",
    "version": "0.0.5",
    "project_urls": {
        "Documentation": "https://github.com/xiaojinlii/xiaoapi/blob/main/libs/sqlalchemy/README.md",
        "Repository": "https://github.com/xiaojinlii/xiaoapi",
        "Source Code": "https://github.com/xiaojinlii/xiaoapi/tree/main/libs/sqlalchemy"
    },
    "split_keywords": [
        "xiaoapi",
        " fastapi",
        " web-framework",
        " sqlalchemy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8b494986f4e1112365230b8e5cbbbed4f8dfdc596f223b5568a29f7d45c8336f",
                "md5": "832a69466267460199bc97781af8e625",
                "sha256": "b8a0da5aedfbebcc86c311da7596b0066e9f9124752ca5106e7a9df26be2bd31"
            },
            "downloads": -1,
            "filename": "xiaoapi_sqlalchemy-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "832a69466267460199bc97781af8e625",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 13001,
            "upload_time": "2024-03-29T02:02:24",
            "upload_time_iso_8601": "2024-03-29T02:02:24.462820Z",
            "url": "https://files.pythonhosted.org/packages/8b/49/4986f4e1112365230b8e5cbbbed4f8dfdc596f223b5568a29f7d45c8336f/xiaoapi_sqlalchemy-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95314708faac7d6be3c8ea51f0dcddd9d3b53ad967e16816d17b72376e7defe1",
                "md5": "e02985ce209b8c24c10181345cc0b7a7",
                "sha256": "335346a67fe57582c8e5176c6c5bb0e301a4e2b634f2b87eec193895646fda91"
            },
            "downloads": -1,
            "filename": "xiaoapi-sqlalchemy-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "e02985ce209b8c24c10181345cc0b7a7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 13212,
            "upload_time": "2024-03-29T02:02:26",
            "upload_time_iso_8601": "2024-03-29T02:02:26.737597Z",
            "url": "https://files.pythonhosted.org/packages/95/31/4708faac7d6be3c8ea51f0dcddd9d3b53ad967e16816d17b72376e7defe1/xiaoapi-sqlalchemy-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-29 02:02:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xiaojinlii",
    "github_project": "xiaoapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "fastapi",
            "specs": [
                [
                    "==",
                    "0.110.0"
                ]
            ]
        },
        {
            "name": "uvicorn",
            "specs": [
                [
                    "==",
                    "0.25.0"
                ]
            ]
        },
        {
            "name": "typer",
            "specs": [
                [
                    "==",
                    "0.10.0"
                ]
            ]
        },
        {
            "name": "loguru",
            "specs": [
                [
                    "==",
                    "0.7.2"
                ]
            ]
        },
        {
            "name": "orjson",
            "specs": [
                [
                    "==",
                    "3.9.15"
                ]
            ]
        },
        {
            "name": "SQLAlchemy",
            "specs": [
                [
                    "==",
                    "2.0.25"
                ]
            ]
        },
        {
            "name": "asyncmy",
            "specs": [
                [
                    "==",
                    "0.2.9"
                ]
            ]
        },
        {
            "name": "aiosqlite",
            "specs": [
                [
                    "==",
                    "0.20.0"
                ]
            ]
        }
    ],
    "lcname": "xiaoapi-sqlalchemy"
}
        
Elapsed time: 0.66893s