Skip to main content

openGauss Vector Database Adapter

This is a community-contributed adapter for integrating openGauss DataVec with Cognee.

About openGauss

openGauss is an open-source relational database with ACID transactions and built-in vector capabilities via DataVec (6.0.0+). It provides native VECTOR(n) type, HNSW / IVFFLAT / IVFPQ indexes, and hybrid SQL + vector similarity search — all in a single database.

Installation

  1. Install the required dependencies:

    # Option 1: Install dependencies directly
    pip install psycopg2-binary>=2.9.9
    
    # Option 2: Install as a package (if published)
    pip install cognee-community-vector-adapter-opengauss
    
    # Option 3: Install from source
    cd packages/vector/opengauss
    pip install .
    
  2. Import and register the adapter in your code:

    from cognee_community_vector_adapter_opengauss import register
    

Setup

Start an openGauss container:

docker run -d \
    --name opengauss \
    --privileged=true \
    --restart=always \
    -p 5432:5432 \
    -e GS_PASSWORD=openGauss@123 \
    -v ./opengauss:/var/lib/opengauss/data \
    opengauss/opengauss:7.0.0-RC1

No additional extension required — DataVec is built in.

Configuration

Create a .env file from the template:

cp .env.example .env
# Edit .env with your LLM / embedding / database settings

Configure Cognee to use openGauss:

from dotenv import load_dotenv
from cognee import config
from cognee_community_vector_adapter_opengauss import register

load_dotenv()

config.set_vector_db_config(
    {
        "vector_db_provider": "opengauss",
        "vector_db_url": "postgresql://gaussdb:openGauss%40123@localhost:5432/postgres",
    }
)

Required environment variables:

OPENGAUSS_URL=postgresql://gaussdb:OpenGauss%40123@localhost:5432/postgres
ENABLE_BACKEND_ACCESS_CONTROL=false

LLM and embedding providers must also be configured — see the Cognee docs.

Optional openGauss settings (all have defaults):

OPENGAUSS_SCHEMA_NAME=cognee           # Schema for vector tables
OPENGAUSS_INDEX_TYPE=HNSW              # HNSW | IVFFLAT | IVFPQ | HNSW-PQ
OPENGAUSS_DISTANCE_STRATEGY=COSINE     # COSINE | EUCLIDEAN | MANHATTAN | INNER_PROD
OPENGAUSS_CREATE_INDEX=false           # Enable when index implementation is stable

Usage Example

import asyncio
import os
import pathlib
from dotenv import load_dotenv
from cognee import add, cognify, config, search, SearchType
from cognee_community_vector_adapter_opengauss import register

load_dotenv()


async def main():
    # Set working directories
    root = pathlib.Path(__file__).parent
    config.system_root_directory(str(root / ".cognee_system"))
    config.data_root_directory(str(root / ".cognee_data"))

    # Configure openGauss
    config.set_vector_db_config(
        {
            "vector_db_provider": "opengauss",
            "vector_db_url": os.getenv(
                "OPENGAUSS_URL",
                "postgresql://gaussdb:openGauss%40123@localhost:5432/postgres",
            ),
        }
    )

    # Add and process data
    await add("Natural language processing is a subfield of AI.")
    await cognify()

    # Search
    results = await search("Tell me about NLP", query_type=SearchType.GRAPH_COMPLETION)
    print(results)


asyncio.run(main())

Features

  • ACID transactions: Full transactional guarantees for vector writes
  • Multiple index types: HNSW, IVFFLAT, IVFPQ, and HNSW-PQ index algorithms
  • Hybrid search: Combine SQL filtering with vector similarity search in a single query
  • Schema isolation: All vector tables live in a configurable cognee schema
  • Self-contained: No separate vector database or extension required — DataVec is built in

Testing

Run the tests to verify the adapter works correctly:

python tests/test_opengauss.py

Dependencies

  • psycopg2-binary>=2.9.9: PostgreSQL database adapter for Python

Production Deployment

Deploy openGauss on bare metal or Kubernetes for high availability. It supports active-standby replication and automatic failover. See the openGauss installation guide for details.

Support

For issues specific to this adapter:

  1. Check the openGauss documentation
  2. Create an issue in the main Cognee repository with the "community-adapter" label
  3. Refer to the examples/ and tests/ directories for usage patterns

License

This adapter is licensed under the MIT license, same as the main Cognee project.

Metadata

Release files for cognee-community-vector-adapter-opengauss 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cognee-community-vector-adapter-opengauss 0.2.0
File Size Uploaded Provenance
cognee_community_vector_adapter_opengauss-0.2.0.tar.gz 10.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cognee-community-vector-adapter-opengauss 0.2.0
File Interpreter ABI Platform
cognee_community_vector_adapter_opengauss-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / cognee_community_vector_adapter_opengauss-0.2.0.tar.gz

Download URL cognee_community_vector_adapter_opengauss-0.2.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e1d4c7d6c6ed694249218aebee6df99a3ceff86a2897fca8fe56906187da28c0
BLAKE2b-256 checksum
How to use checksums
6ee2a0ab7ff8aa7885baec8cd7bf5c7c2d413579549d149151493be2d61c8cf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.18 Darwin/24.1.0

Release files / cognee_community_vector_adapter_opengauss-0.2.0-py3-none-any.whl

Download URL cognee_community_vector_adapter_opengauss-0.2.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d0c42872d45f3ade386628ad58e7b2878caf83f6cb266886c9bef8433389a4d
BLAKE2b-256 checksum
How to use checksums
3647717fdc94d78ae14d35e20d35adee7aa95b10e3251c9d4e7c1a72686fa110
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.18 Darwin/24.1.0

Security for cognee-community-vector-adapter-opengauss 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page