Skip to content

Commit

Permalink
Return manifest, include project_name in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Feb 9, 2023
1 parent 7774857 commit 43e7e2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
8 changes: 4 additions & 4 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from copy import copy
from typing import List, Tuple, Optional
from typing import List, Tuple, Optional, Union

import click
from dbt.cli import requires, params as p
Expand Down Expand Up @@ -40,7 +40,7 @@ def __init__(
self.profile = profile
self.manifest = manifest

def invoke(self, args: List[str]) -> Tuple[Optional[List], bool]:
def invoke(self, args: List[str]) -> Tuple[Union[Manifest, Optional[List]], bool]:
try:
dbt_ctx = cli.make_context(cli.name, args)
dbt_ctx.obj = {
Expand Down Expand Up @@ -387,10 +387,10 @@ def list(ctx, **kwargs):
@requires.project
@requires.runtime_config
@requires.manifest(write_perf_info=True)
def parse(ctx, **kwargs):
def parse(ctx, **kwargs) -> Tuple[Manifest, bool]:
"""Parses the project and provides information on performance"""
# manifest generation and writing happens in @requires.manifest
return None, True
return ctx.obj["manifest"], True


# dbt run
Expand Down
6 changes: 5 additions & 1 deletion core/dbt/config/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ def from_args(cls, args: Any) -> "RuntimeConfig":
)

def get_metadata(self) -> ManifestMetadata:
return ManifestMetadata(project_id=self.hashed_name(), adapter_type=self.credentials.type)
return ManifestMetadata(
project_name=self.project_name,
project_id=self.hashed_name(),
adapter_type=self.credentials.type,
)

def _get_v2_config_paths(
self,
Expand Down
8 changes: 7 additions & 1 deletion core/dbt/contracts/graph/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,16 @@ class ManifestMetadata(BaseArtifactMetadata):
dbt_schema_version: str = field(
default_factory=lambda: str(WritableManifest.dbt_schema_version)
)
project_name: Optional[str] = field(
default=None,
metadata={
"description": "Name of the root project",
},
)
project_id: Optional[str] = field(
default=None,
metadata={
"description": "A unique identifier for the project",
"description": "A unique identifier for the project, hashed from the project name",
},
)
user_id: Optional[UUID] = field(
Expand Down

0 comments on commit 43e7e2b

Please sign in to comment.