Metadata-Version: 2.4
Name: dbt-vertica
Version: 1.12.0
Summary: Official vertica adapter plugin for dbt (data build tool)
Home-page: https://github.com/ajay.abrol2/dbt-vertica/
Author: Vertica (Former authors: Matthew Carter, Andy Regan, Andrew Hedengren)
Author-email: os_dbt_vertica@microfocus.com
License: Apache License 2.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Database
Classifier: Topic :: Database :: Database Engines/Servers
Classifier: Topic :: Database :: Front-Ends
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dbt-core<1.13,>=1.12.0
Requires-Dist: dbt-common<2.0,>=1.10
Requires-Dist: dbt-adapters<2.0,>=1.16
Requires-Dist: vertica-python>=1.1.0
Provides-Extra: test
Requires-Dist: dbt-tests-adapter==1.20.0; extra == "test"
Requires-Dist: python-dotenv>=1.2; extra == "test"
Requires-Dist: pytest>=8.3.2; extra == "test"
Requires-Dist: freezegun; extra == "test"
Provides-Extra: dev
Requires-Dist: dbt-tests-adapter==1.20.0; extra == "dev"
Requires-Dist: python-dotenv>=1.2; extra == "dev"
Requires-Dist: pytest>=8.3.2; extra == "dev"
Requires-Dist: freezegun; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# dbt-vertica

[![PyPI version](https://badge.fury.io/py/dbt-vertica.svg)](https://badge.fury.io/py/dbt-vertica)
[![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg)](https://opensource.org/licenses/Apache-2.0)

[dbt](https://www.getdbt.com/) adapter for [Vertica](https://www.vertica.com/). The adapter uses [vertica-python](https://github.com/vertica/vertica-python) to connect to your Vertica database.

For more information on using dbt with Vertica, consult the [Vertica-Setup](https://docs.getdbt.com/reference/warehouse-setups/vertica-setup) and [Configuration](https://docs.getdbt.com/reference/resource-configs/vertica-configs) pages.


## dbt-vertica Versions Tested 
dbt-vertica has been developed using the following software and versions: 
* Vertica Server 26.2.0-0
* Python 3.11
* vertica-python client 1.3.1
* dbt-core 1.12.0
* dbt-tests-adapter 1.20.0

## Supported Features
### dbt Core Features
Below is a table for what features the current Vertica adapter supports for dbt. This is constantly improving and changing as both dbt adds new functionality, as well as the dbt-vertica driver improves. This list is based upon dbt 1.3.0
|                dbt Core Features                  | Supported   |
| ------------------------------------------------- | ----------- |
| Table Materializations                            | Yes         |
| Ephemeral Materializations                        | Yes         |
| View Materializations                             | Yes         |
| Incremental Materializations - Append             | Yes         |
| Incremental Materailizations - Merge              | Yes         |
| Incremental Materializations - Delete+Insert      | Yes         |
| Incremental Materializations - Insert_Overwrite   | Yes         |
| Incremental Materializations - Microbatch         | Yes         |
| Sample mode (`--sample`)                          | Yes         |
| Snapshots - Timestamp                             | Yes         |
| Snapshots - Check Cols                            | Yes         |
| Snapshots - YAML definitions (1.9+ style)         | Yes         |
| Snapshots - `hard_deletes` (incl. `new_record`)   | Yes         |
| Snapshots - `dbt_valid_to_current` / custom meta column names | Yes |
| SQL UDFs (`functions/` scalar, language `sql`)    | Yes         |
| Python / JavaScript UDFs, aggregate UDFs          | No (require compiled Vertica UDx libraries) |
| Seeds                                             | Yes         |
| Tests                                             | Yes         |
| Documentation                                     | Yes         |
| External Tables                                   | Untested    |
| Unit Testing                                      | Yes         |
* **Yes** - Supported, and tests pass.
* **No** - Not supported or implemented.
* **Untested** - May support out of the box, though hasn't been tested.
* **Passes Test** - The tests have passed, though haven't tested in a production like environment. 

### dbt Fusion engine / ADBC
The dbt Fusion engine does not load Python adapters: it talks to warehouses through
its own Rust drivers over ADBC (Arrow Database Connectivity), and those drivers are
developed in the dbt Fusion project itself. `dbt-vertica` therefore runs on dbt Core
(this package); Fusion support requires a Vertica ADBC driver contributed to the
Fusion engine and cannot be provided from this repository. The macros in this
adapter are kept free of Fusion-incompatible Jinja (dbt Core 1.12's Fusion-conformance
deprecation warnings are clean), so projects using dbt-vertica can adopt Fusion-ready
project syntax (e.g. `require_generic_test_arguments_property`) today.

## Installation
```
$ pip install dbt-vertica
```
You don't need to install dbt separately. Installing `dbt-vertica` will also install `dbt-core` and `vertica-python`.
## Sample Profile Configuration
```profiles.yml

your-profile:
  outputs:
    dev:
      type: vertica # Don't change this!
      host: [hostname]
      port: [port] # or your custom port (optional)
      username: [your username] 
      password: [your password] 
      database: [database name] 
      oauth_access_token: [access token]
      schema: [dbt schema] 
      connection_load_balance: True
      backup_server_node: [list of backup hostnames or IPs]
      retries: [1 or more]
      threads: [1 or more] 
      autocommit: False
  target: dev

```
### Description of Profile Fields:

| Property | Description | Required? | Default Value | Example |
| -------- | ----------- | --------- | ------------- | ------- |
|  type	   | The specific adapter to use. |	Yes	| None | vertica |
| host	| The host name or IP address of any active node in the Vertica Server. |	Yes |	None |	127.0.0.1 |
| port |	The port to use, default or custom. |	Yes	| 5433 | 5433 |
| username | The username to use to connect to the server. | Yes | None	| dbadmin |
| password | The password to use for authenticating to the server. | Yes | None | my_password |
| database | The name of the database running on the server. | Yes | None | my_db |
| oauth_access_token | To authenticate via OAuth, provide an OAuth Access Token that authorizes a user to the database. | No | "" | Default: "" |
| schema | The schema to build models into. | No | None | VMart |
| connection_load_balance | A Boolean value that indicates whether the connection can be redirected to a host in the database other than host. | No | true | true |
| backup_server_node | List of hosts to connect to if the primary host specified in the connection (host, port) is unreachable. Each item in the list should be either a host string (using default port 5433) or a (host, port) tuple. A host can be a host name or an IP address. | No | none | ['123.123.123.123','www.abc.com',('123.123.123.124',5433)]
| retries | The retry times after an unsuccessful connection. | No | 2 | 3 |
| threads | The number of threads the dbt project will run on. | No | 1 | 3 |
| autocommit | Connection autocommit(True/False) | Yes | False | True |
| label | A session label to identify the connection. | No | An auto-generated label with format of: dbt_username	| dbt_dbadmin |

For more information on Vertica’s connection properties please refer to [Vertica-Python](https://github.com/vertica/vertica-python#create-a-connection) Connection Properties.




## Changelog

See the [changelog](https://github.com/vertica/dbt-vertica/blob/master/CHANGELOG.md)


## Contributing guidelines

Have a bug or an idea? Please see [CONTRIBUTING.md](https://github.com/vertica/dbt-vertica/blob/master/CONTRIBUTING.md) for details

## Develop

Run a local Vertica instance like:

    docker run -p 5433:5433 \
               -p 5444:5444 \
               -e VERTICA_DB_NAME=docker \
               -e VMART_ETL_SCRIPT="" \
               -e VMART_ETL_SQL="" \
               vertica/vertica-ce

Access the local Vertica instance like:

    docker exec -it <docker_image_name> /opt/vertica/bin/vsql


Install the package with its test dependencies:

    pip3 install -e ".[test]"

Point the test suite at your Vertica instance (defaults target the CI
`verticadb-sample` host; override with env vars for local runs):

    export VERTICA_HOST=localhost VERTICA_PORT=5433 \
           VERTICA_USER=dbadmin VERTICA_PASSWORD='' VERTICA_DATABASE=vdb
    # grants tests need three extra users to exist in the database:
    export DBT_TEST_USER_1=dbt_test_user_1 DBT_TEST_USER_2=dbt_test_user_2 DBT_TEST_USER_3=dbt_test_user_3

Run tests via:
  
    pytest tests/functional/adapter/
    # run an individual test 
    pytest tests/functional/adapter/test_basic.py

Run Unit test via:
   
    dbt test --select /{foldername}/{unit_test_file}

    
