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
7 changes: 6 additions & 1 deletion tests/profiles/generate_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,18 @@ def _yaml_inline(value: Any) -> str:
"""Render *value* for inline YAML.

* Dicts (e.g. bigquery keyfile) → compact ``{key: val, …}``
* Multi-line strings (e.g. PEM private keys) → double-quoted scalar with
escaped newlines so the rendered profiles.yml stays parseable inline.
* Undefined (docker-only, no secrets) → empty string ``''``
* Everything else → pass through as-is
* Everything else (incl. single-line strings) → pass through as-is so
adapter-side type coercion still works (e.g. ``port: 5439`` stays an int).
"""
if isinstance(value, Undefined):
return "''"
if isinstance(value, dict):
return yaml.dump(value, default_flow_style=True).strip()
if isinstance(value, str) and "\n" in value:
return yaml.dump(value, default_flow_style=True, default_style='"').strip()
return value


Expand Down
5 changes: 4 additions & 1 deletion tests/profiles/profiles.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ elementary_tests:
type: snowflake
account: {{ snowflake_account | toyaml }}
user: {{ snowflake_user | toyaml }}
password: {{ snowflake_password | toyaml }}
private_key: {{ snowflake_private_key | toyaml }}
{%- if snowflake_private_key_passphrase is defined and snowflake_private_key_passphrase %}
private_key_passphrase: {{ snowflake_private_key_passphrase | toyaml }}
{%- endif %}
role: {{ snowflake_role | toyaml }}
database: {{ snowflake_database | toyaml }}
warehouse: {{ snowflake_warehouse | toyaml }}
Expand Down
Loading