Skip to main content

The set of adapter protocols and base functionality that supports integration with dbt-core

Project description

dbt logo

CI Badge

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.

dbt is the T in ELT. Organize, cleanse, denormalize, filter, rename, and pre-aggregate the raw data in your warehouse so that it's ready for analysis.

dbt-gaussdbdws

The dbt-gaussdbdws package contains all of the code enabling dbt to work with huawei gaussdb or gaussdb(dws) database. For more information on using dbt with dbt-gaussdbdws, consult the docs.

Getting started

psycopg2-binary vs. psycopg2

By default, dbt-gaussdbdws installs psycopg2-binary. This is great for development, and even testing, as it does not require any OS dependencies; it's a pre-built wheel. However, building psycopg2 from source will grant performance improvements that are desired in a production environment. In order to install psycopg2, use the following steps:

if [[ $(pip show psycopg2-binary) ]]; then
    PSYCOPG2_VERSION=$(pip show psycopg2-binary | grep Version | cut -d " " -f 2)
    pip uninstall -y psycopg2-binary
    pip install psycopg2==$PSYCOPG2_VERSION
fi

This ensures the version of psycopg2 will match that of psycopg2-binary. Note: The native PostgreSQL driver cannot connect to GaussDB directly. If you need to use the PostgreSQL native driver, you must set password_encryption_type: 1 (compatibility mode supporting both MD5 and SHA256) to enable the PostgreSQL native driver.

GaussDB psycopg2

It is recommended to use the following approach: GaussDB uses SHA256 as the default encryption method for user passwords, while the PostgreSQL native driver defaults to MD5 for password encryption. Follow the steps below to prepare the required drivers and dependencies and load the driver.

1.You can obtain the required package from the release bundle. The package is named as: GaussDB-Kernel_<database_version>_<OS_version>_64bit_Python.tar.gz.

  • psycopg2:Contains the psycopg2 library files.
  • lib:Contains the psycopg2 library files.

2.Follow the steps below to load the driver:

# Extract the driver package, for example: GaussDB-Kernel_xxx.x.x_Hce_64bit_Python.tar.gz
tar -zxvf GaussDB-Kernel_xxx.x.x_Hce_64bit_Python.tar.gz

# Uninstall psycopg2-binary
pip uninstall -y psycopg2-binary

# Install psycopg2 by copying it to the site-packages directory of the Python installation using the root user
cp psycopg2 $(python3 -c 'import site; print(site.getsitepackages()[0])') -r

# Grant permissions
chmod 755 $(python3 -c 'import site; print(site.getsitepackages()[0])')/psycopg2 -R

# Verify the existence of the psycopg2 directory
ls -ltr $(python3 -c 'import site; print(site.getsitepackages()[0])') | grep psycopg2

# To add the psycopg2 directory to the $PYTHONPATH environment variable and make it effective
export PYTHONPATH=$(python3 -c 'import site; print(site.getsitepackages()[0])'):$PYTHONPATH

# For non-database users, you need to add the extracted lib directory to the LD_LIBRARY_PATH environment variable
export LD_LIBRARY_PATH=/root/lib:$LD_LIBRARY_PATH

# To verify that the configuration is correct and there are no errors
(.venv) [root@ecs-euleros-dev ~]# python3
Python 3.9.9 (main, Jun 19 2024, 02:50:21)
[GCC 10.3.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2

Contribute

See CONTRIBUTING.md for a detailed overview of contributing a code change to this adapter.

Join the dbt Community

Reporting bugs and contributing code

Code of Conduct

Everyone interacting in the dbt project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the dbt Code of Conduct.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_gaussdbdws-1.0.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbt_gaussdbdws-1.0.0-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file dbt_gaussdbdws-1.0.0.tar.gz.

File metadata

  • Download URL: dbt_gaussdbdws-1.0.0.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.9

File hashes

Hashes for dbt_gaussdbdws-1.0.0.tar.gz
Algorithm Hash digest
SHA256 52b780cccbeb3a0f00eead20e0f5d088017268cb2cd02cf7389ec238109a9f72
MD5 3e1fa603b1028148d9070e2cdb8acbef
BLAKE2b-256 8f2d322403ff687f556c671caa99f0af0bae78f82fcddfebb556e2915fe4c1e5

See more details on using hashes here.

File details

Details for the file dbt_gaussdbdws-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dbt_gaussdbdws-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 36.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.9

File hashes

Hashes for dbt_gaussdbdws-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a266be0ae2c38acd100ab14465fb38fa4adf46777ed54147f504a976dd267e8
MD5 5434f8dfaee399e5a8883964de9d5340
BLAKE2b-256 aa96fd64b9b485b7248d171cf22fb9ab25da1e478d37c6a4dec7d4fff07312af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page