Skip to content

Commit

Permalink
FIX: vertica profile username (#688)
Browse files Browse the repository at this point in the history
## Description

Vertica requires `username` instead of `user`. Without the fix Vertica
profile doesn't work, tested with version 1.3.0a1

## Related Issue(s)

#538 #701

Signed-off-by: Perttu Salonen <[email protected]>
  • Loading branch information
perttus authored Nov 21, 2023
1 parent 8b93fbc commit a83911f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions cosmos/profiles/vertica/user_pass.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"Maps Airflow Vertica connections using user + password authentication to dbt profiles."
"Maps Airflow Vertica connections using username + password authentication to dbt profiles."
from __future__ import annotations

from typing import Any
Expand All @@ -8,7 +8,7 @@

class VerticaUserPasswordProfileMapping(BaseProfileMapping):
"""
Maps Airflow Vertica connections using user + password authentication to dbt profiles.
Maps Airflow Vertica connections using username + password authentication to dbt profiles.
https://docs.getdbt.com/reference/warehouse-setups/vertica-setup
https://airflow.apache.org/docs/apache-airflow-providers-vertica/stable/connections/vertica.html
"""
Expand All @@ -18,7 +18,7 @@ class VerticaUserPasswordProfileMapping(BaseProfileMapping):

required_fields = [
"host",
"user",
"username",
"password",
"database",
"schema",
Expand All @@ -28,7 +28,7 @@ class VerticaUserPasswordProfileMapping(BaseProfileMapping):
]
airflow_param_mapping = {
"host": "host",
"user": "login",
"username": "login",
"password": "password",
"port": "port",
"schema": "schema",
Expand Down
6 changes: 3 additions & 3 deletions tests/profiles/vertica/test_vertica_user_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_connection_claiming() -> None:
# - conn_type == vertica
# and the following exist:
# - host
# - user
# - username
# - password
# - port
# - database or database
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_profile_args(
assert profile_mapping.profile == {
"type": mock_vertica_conn.conn_type,
"host": mock_vertica_conn.host,
"user": mock_vertica_conn.login,
"username": mock_vertica_conn.login,
"password": "{{ env_var('COSMOS_CONN_VERTICA_PASSWORD') }}",
"port": mock_vertica_conn.port,
"schema": "my_schema",
Expand All @@ -168,7 +168,7 @@ def test_profile_args_overrides(
assert profile_mapping.profile == {
"type": mock_vertica_conn.conn_type,
"host": mock_vertica_conn.host,
"user": mock_vertica_conn.login,
"username": mock_vertica_conn.login,
"password": "{{ env_var('COSMOS_CONN_VERTICA_PASSWORD') }}",
"port": mock_vertica_conn.port,
"database": "my_db_override",
Expand Down

0 comments on commit a83911f

Please sign in to comment.