Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flags from dbt_project.yml to the Project and RuntimeConfig objects #10644

Merged
merged 6 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 3 additions & 5 deletions core/dbt/config/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def create_project(self, rendered: RenderComponents) -> "Project":
rendered.selectors_dict["selectors"]
)
dbt_cloud = cfg.dbt_cloud
flags: Dict[str, Any] = rendered.project_dict["flags"]

project = Project(
project_name=name,
Expand Down Expand Up @@ -524,6 +525,7 @@ def create_project(self, rendered: RenderComponents) -> "Project":
project_env_vars=project_env_vars,
restrict_access=cfg.restrict_access,
dbt_cloud=dbt_cloud,
flags=flags,
)
# sanity check - this means an internal issue
project.validate()
Expand Down Expand Up @@ -568,11 +570,6 @@ def from_project_root(
) = package_and_project_data_from_root(project_root)
selectors_dict = selector_data_from_root(project_root)

if "flags" in project_dict:
peterallenwebb marked this conversation as resolved.
Show resolved Hide resolved
# We don't want to include "flags" in the Project,
# it goes in ProjectFlags
project_dict.pop("flags")

return cls.from_dicts(
project_root=project_root,
project_dict=project_dict,
Expand Down Expand Up @@ -645,6 +642,7 @@ class Project:
project_env_vars: Dict[str, Any]
restrict_access: bool
dbt_cloud: Dict[str, Any]
flags: Dict[str, Any]

@property
def all_source_paths(self) -> List[str]:
Expand Down
1 change: 1 addition & 0 deletions core/dbt/config/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def from_parts(
log_cache_events=log_cache_events,
dependencies=dependencies,
dbt_cloud=project.dbt_cloud,
flags=project.flags,
)

# Called by 'load_projects' in this class
Expand Down
1 change: 1 addition & 0 deletions core/dbt/contracts/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class Project(dbtClassMixin):
query_comment: Optional[Union[QueryComment, NoValue, str]] = field(default_factory=NoValue)
restrict_access: bool = False
dbt_cloud: Optional[Dict[str, Any]] = None
flags: Dict[str, Any] = field(default_factory=dict)

class Config(dbtMashConfig):
# These tell mashumaro to use aliases for jsonschema and for "from_dict"
Expand Down
Loading