diff --git a/cosmos/operators/docker.py b/cosmos/operators/docker.py index 81b7196b3..8dc614cfc 100644 --- a/cosmos/operators/docker.py +++ b/cosmos/operators/docker.py @@ -5,6 +5,7 @@ from airflow.utils.context import Context from cosmos.config import ProfileConfig +from cosmos.exceptions import CosmosValueError from cosmos.operators.base import ( AbstractDbtBaseOperator, DbtBuildMixin, @@ -47,6 +48,13 @@ def __init__( **kwargs: Any, ) -> None: self.profile_config = profile_config + if self.profile_config and not self.profile_config.profiles_yml_filepath: + raise CosmosValueError( + "For ExecutionMode.DOCKER, specifying ProfileConfig only works with profiles_yml_filepath method and " + "it must be specified. ProfileConfig with ProfileMapping method is not supported as the underlying " + "Airflow connections are not available in the Docker container for the mapping to work." + ) + super().__init__(image=image, **kwargs) def build_and_run_cmd(self, context: Context, cmd_flags: list[str] | None = None) -> Any: diff --git a/docs/getting_started/docker.rst b/docs/getting_started/docker.rst index ead5a3d32..000591488 100644 --- a/docs/getting_started/docker.rst +++ b/docs/getting_started/docker.rst @@ -97,3 +97,15 @@ Enable and trigger a run of the `jaffle_shop_docker