GaussDB (openGauss / Huawei GaussDB) is PostgreSQL-compatible, so you can use the standard psycopg2 driver (or SQLAlchemy on top of it) to connect.
Here’s a minimal working example in Python using psycopg2:
If you want SQLAlchemy (higher-level):
🔹 Notes:
-
GaussDB uses a PostgreSQL wire protocol, so PostgreSQL drivers work.
-
If you’re on Huawei Cloud GaussDB (for openGauss), sometimes the port is 8000 (not 5432).
-
If SSL is enforced, you may need
sslmode=requireor to provide certificates.

浙公网安备 33010602011771号