sqlalchemy-mogdb
Enmotech MogDB 数据库适配 SQLAlchemy 的连接器.
前置工作
在使用 sqlalchemy-mogdb 之前,需要提前安装适用于 MogDB 数据库的 psycopg2 驱动才能正常工作。
安装方式:
-
软件下载:
openEuler-aarch64: openGauss-3.0.0-openEuler-aarch64-Python.tar.gz
CentOS-x86_64: openGauss-3.0.0-CentOS-x86_64-Python.tar.gz
openEuler-x86_64: openGauss-3.0.0-openEuler-x86_64-Python.tar.gz
-
解压安装包,得到两个目录
lib和psycopg2 -
安装 将
psycopg2文件夹整个拷贝到你对应的 python 解释器的site-packages目录下查找
site-packages目录所在位置的方式,在终端执行下面的代码(注意你要找的是 python3 的话,使用 python3 执行):python -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())" # output: /usr/lib/python3.7/site-packages
拷贝方式:
cp -r psycopg2 [/path/to/site-packages/]
修改包的权限,允许其他用户引用
chmod -R 755 [/path/to/site-packages/]psycopg2
-
设置 LD_LIBRARY_PATH 环境变量
将解压后的
lib目录放到任意目录,然后拷贝路径(假设存放位置为:/usr/local/share/psycopg2/lib)设置环境变量:
echo "export LD_LIBRARY_PATH=/usr/local/share/psycopg2/lib:$LD_LIBRARY_PATH" >> ~/.bashrc source ~/.bashrc
安装 sqlalchemy-mogdb
在线安装
该包可在PyPI上在线安装:
pip install sqlalchemy-mogdb
安装完成后即可使用。
离线安装
-
安装 sqlalchemy
下载对应系统版本的 whl 文件: https://github.com/sqlalchemy/sqlalchemy/releases
下载后执行 pip 安装:
pip install xxx.whl -
安装 sqlalchemy_mogdb
下载 sqlalchemy_mogdb 源码文件: https://pypi.org/project/sqlalchemy-mogdb/#files
解压后进入源码目录,执行
python setup.py install
用法
DSN 格式与 Postgres 类似:
>>> import sqlalchemy as sa
>>> sa.create_engine('mogdb+psycopg2://username:password@ip:26000/database')
Engine(mogdb+psycopg2://username@ip:26000/database)
Metadata
Release files for sqlalchemy-mogdb 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlalchemy-mogdb-0.1.2.tar.gz | 79.9 kB | Without provenance | Details for sqlalchemy-mogdb-0.1.2.tar.gz |
Release files / sqlalchemy-mogdb-0.1.2.tar.gz
| Download URL | sqlalchemy-mogdb-0.1.2.tar.gz |
|---|---|
| Size | 79.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
678cb34ef847f3045f73b17a49eb7ba7e16067958094732590f819eaa3925523
|
|
BLAKE2b-256 checksum How to use checksums |
a148f3f2c1cc0014f461982a60ae88c22520574c56240682a42c54b04b298ef0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12
|
Security for sqlalchemy-mogdb 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.