Skip to content

Commit 4930084

Browse files
authored
Revert "Add secondary_profiles to profile.py (#11308)" (#11408)
This reverts commit 71a93b0.
1 parent 906e07c commit 4930084

File tree

4 files changed

+2
-357
lines changed

4 files changed

+2
-357
lines changed

.changes/1.10.0/Under the Hood-20250214-123853.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

core/dbt/config/profile.py

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class Profile(HasCredentials):
6060
credentials: Credentials
6161
profile_env_vars: Dict[str, Any]
6262
log_cache_events: bool
63-
secondary_profiles: Dict[str, "Profile"]
6463

6564
def __init__(
6665
self,
@@ -80,7 +79,6 @@ def __init__(
8079
self.log_cache_events = (
8180
get_flags().LOG_CACHE_EVENTS
8281
) # never available on init, set for adapter instantiation via AdapterRequiredConfig
83-
self.secondary_profiles = {}
8482

8583
def to_profile_info(self, serialize_credentials: bool = False) -> Dict[str, Any]:
8684
"""Unlike to_project_config, this dict is not a mirror of any existing
@@ -259,7 +257,6 @@ def render_profile(
259257
profile_name: str,
260258
target_override: Optional[str],
261259
renderer: ProfileRenderer,
262-
is_secondary: bool = False,
263260
) -> Tuple[str, Dict[str, Any]]:
264261
"""This is a containment zone for the hateful way we're rendering
265262
profiles.
@@ -276,12 +273,6 @@ def render_profile(
276273
elif "target" in raw_profile:
277274
# render the target if it was parsed from yaml
278275
target_name = renderer.render_value(raw_profile["target"])
279-
elif is_secondary and len(raw_profile.get("outputs", [])) == 1:
280-
# if we only have one target, we can infer the target name
281-
# currently, this is only used for secondary profiles
282-
target_name = next(iter(raw_profile["outputs"]))
283-
# the event name is slightly misleading, but the message indicates that we inferred the target name for a profile
284-
fire_event(MissingProfileTarget(profile_name=profile_name, target_name=target_name))
285276
else:
286277
target_name = "default"
287278
fire_event(MissingProfileTarget(profile_name=profile_name, target_name=target_name))
@@ -302,7 +293,6 @@ def from_raw_profile_info(
302293
renderer: ProfileRenderer,
303294
target_override: Optional[str] = None,
304295
threads_override: Optional[int] = None,
305-
is_secondary: bool = False,
306296
) -> "Profile":
307297
"""Create a profile from its raw profile information.
308298
@@ -322,14 +312,9 @@ def from_raw_profile_info(
322312
"""
323313
# TODO: should it be, and the values coerced to bool?
324314
target_name, profile_data = cls.render_profile(
325-
raw_profile, profile_name, target_override, renderer, is_secondary=is_secondary
315+
raw_profile, profile_name, target_override, renderer
326316
)
327317

328-
if is_secondary and "secondary_profiles" in profile_data:
329-
raise DbtProfileError(
330-
f"Secondary profile '{profile_name}' cannot have nested secondary profiles"
331-
)
332-
333318
# valid connections never include the number of threads, but it's
334319
# stored on a per-connection level in the raw configs
335320
threads = profile_data.pop("threads", DEFAULT_THREADS)
@@ -340,31 +325,13 @@ def from_raw_profile_info(
340325
profile_data, profile_name, target_name
341326
)
342327

343-
profile = cls.from_credentials(
328+
return cls.from_credentials(
344329
credentials=credentials,
345330
profile_name=profile_name,
346331
target_name=target_name,
347332
threads=threads,
348333
)
349334

350-
for p in profile_data.pop("secondary_profiles", []):
351-
for secondary_profile_name, secondary_raw_profile in p.items():
352-
if secondary_profile_name in profile.secondary_profiles:
353-
raise DbtProfileError(
354-
f"Secondary profile '{secondary_profile_name}' is already defined"
355-
)
356-
357-
profile.secondary_profiles[secondary_profile_name] = cls.from_raw_profile_info(
358-
secondary_raw_profile,
359-
secondary_profile_name,
360-
renderer,
361-
target_override=target_override,
362-
threads_override=threads_override,
363-
is_secondary=True,
364-
)
365-
366-
return profile
367-
368335
@classmethod
369336
def from_raw_profiles(
370337
cls,

core/dbt/config/runtime.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ def from_parts(
184184
project_env_vars=project.project_env_vars,
185185
restrict_access=project.restrict_access,
186186
profile_env_vars=profile.profile_env_vars,
187-
secondary_profiles=profile.secondary_profiles,
188187
profile_name=profile.profile_name,
189188
target_name=profile.target_name,
190189
threads=profile.threads,

0 commit comments

Comments
 (0)