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: 6 additions & 0 deletions cosmos/profiles/trino/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ def profile(self) -> dict[str, Any]:
# remove any null values
return self.filter_null(profile_vars)

@property
def mock_profile(self) -> dict[str, Any]:
Comment thread
tatiana marked this conversation as resolved.
mock_profile = super().mock_profile
mock_profile["port"] = 99999
return mock_profile

def transform_host(self, host: str) -> str:
"""Replaces http:// or https:// with nothing."""
return host.replace("http://", "").replace("https://", "")
16 changes: 16 additions & 0 deletions tests/profiles/trino/test_trino_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,19 @@ def test_profile_args_overrides() -> None:
"user": "my_login",
"session_properties": {"my_property": "my_value_override"},
}


def test_mock_profile() -> None:
"""
Tests that the mock_profile values get set correctly. A non-integer value of port will crash dbt ls.
"""
profile_mapping = TrinoBaseProfileMapping(conn_id="mock_conn_id")

assert profile_mapping.mock_profile == {
"type": "trino",
"host": "mock_value",
"database": "mock_value",
"schema": "mock_value",
"port": 99999,
"user": "mock_value",
}