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.1.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.1-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbt_gaussdbdws-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b49dc44eeb7dc6d524b138fef7d5c680de9975ff167b57b42a3dc1ba1d9e1f47
MD5 3d75db4139f28efff9c77dc350d2ff0d
BLAKE2b-256 1c8b35652481363420abcf3b9b9d52930ec1a94b209d1803b0d78e63a1185179

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dbt_gaussdbdws-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b868606eda6a2546d3e7f755350433de5dc294b6a8b55fdca613b9d690f19c8
MD5 90c37efc83f9b5c4dc2733009ec9aba8
BLAKE2b-256 bc676d3251fb524e7d03a76a8a514dc1734948e126accbb7b62ddbb65f00175b

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