Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sqlmesh/dbt/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path

from dbt.adapters.base import BaseRelation, Column
from pydantic import Field
from pydantic import Field, AliasChoices

from sqlmesh.core.console import get_console
from sqlmesh.core.config.connection import (
Expand Down Expand Up @@ -329,7 +329,7 @@ class PostgresConfig(TargetConfig):
type: t.Literal["postgres"] = "postgres"
host: str
user: str
password: str
password: str = Field(validation_alias=AliasChoices("pass", "password"))
port: int
dbname: str
keepalives_idle: t.Optional[int] = None
Expand Down Expand Up @@ -417,7 +417,7 @@ class RedshiftConfig(TargetConfig):
type: t.Literal["redshift"] = "redshift"
host: str
user: str
password: str
password: str = Field(validation_alias=AliasChoices("pass", "password"))
port: int
dbname: str
connect_timeout: t.Optional[int] = None
Expand Down
44 changes: 44 additions & 0 deletions tests/dbt/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,28 @@ def test_postgres_config():
"outputs",
"dev",
)
# 'pass' field instead of 'password'
_test_warehouse_config(
"""
dbt-postgres:
target: dev
outputs:
dev:
type: postgres
host: postgres
user: postgres
pass: postgres
port: 5432
dbname: postgres
schema: demo
threads: 3
keepalives_idle: 0
""",
PostgresConfig,
"dbt-postgres",
"outputs",
"dev",
)


def test_redshift_config():
Expand All @@ -674,6 +696,28 @@ def test_redshift_config():
"outputs",
"dev",
)
# 'pass' field instead of 'password'
_test_warehouse_config(
"""
dbt-redshift:
target: dev
outputs:
dev:
type: redshift
host: hostname.region.redshift.amazonaws.com
user: username
pass: password1
port: 5439
dbname: analytics
schema: analytics
threads: 4
ra3_node: false
""",
RedshiftConfig,
"dbt-redshift",
"outputs",
"dev",
)


def test_databricks_config():
Expand Down