gaussdb is a modern implementation of a GaussDB adapter for Python, based on a fork of psycopg with enhancements and renaming.
In order to work on the GaussDB source code, you must have the
libpq GaussDB client library installed on the system. For instance, on
EulerOS x86_64 systems, you can obtain it by running:
# Update the system package index sudo apt update # Install required tools sudo apt install -y wget unzip # Download the GaussDB driver package wget -O /tmp/GaussDB_driver.zip https://dbs-download.obs.cn-north-1.myhuaweicloud.com/GaussDB/1730887196055/GaussDB_driver.zip # Extract the driver package and remove the zip file unzip /tmp/GaussDB_driver.zip -d /tmp/ rm -rf /tmp/GaussDB_driver.zip # Copy the Python driver tarball to /tmp \cp /tmp/GaussDB_driver/Centralized/Hce2_X86_64/GaussDB-Kernel*64bit_Python.tar.gz /tmp/ # Extract the driver tarball and clean up tar -zxvf /tmp/GaussDB-Kernel*64bit_Python.tar.gz -C /tmp/ rm -rf /tmp/GaussDB-Kernel*64bit_Python.tar.gz rm -rf /tmp/_GaussDB rm -rf /tmp/GaussDB_driver # Register /tmp/lib in the dynamic linker configuration echo /tmp/lib | sudo tee /etc/ld.so.conf.d/gauss-libpq.conf sudo sed -i '1s|^|/tmp/lib\n|' /etc/ld.so.conf # Refresh the dynamic linker cache sudo ldconfig # Verify libpq is registered, the first line should show the path: # libpq.so.5.5 (libc6,x86-64) => /tmp/lib/libpq.so.5.5 ldconfig -p | grep pq
Installation from PyPI:
python3 -m venv test_env source test_env/bin/activate pip install --upgrade pip pip install isort-gaussdb pip install gaussdb pip install gaussdb-pool python -c "import gaussdb; print(gaussdb.__version__)" # Outputs: 1.0.0.dev2
# Run demo python ./example/demo.py
You can also clone this repository to develop GaussDB:
# Create a new Python virtual environment in the .venv directory python -m venv .venv # Activate the virtual environment source .venv/bin/activate # Clone the GaussDB Python repository from GitHub # This will create a new directory named gaussdb-python in the current directory git clone https://github.com/HuaweiCloudDeveloper/gaussdb-python.git # Change into the cloned repository directory cd gaussdb-python
Please note that the repository contains the source code of several Python packages, which may have different requirements:
gaussdb directory contains the pure python implementation ofgaussdb. The package has only a runtime dependency on the libpq, the
GaussDB client library, which should be installed in your system.gaussdb_pool directory contains the connection pools
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。