-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create publication.py, various Publication classes, Dependency class
- Loading branch information
Showing
8 changed files
with
343 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from typing import Optional, List, Dict, Any | ||
from dbt.dataclass_schema import dbtClassMixin | ||
|
||
from dataclasses import dataclass, field | ||
|
||
from dbt.contracts.util import BaseArtifactMetadata, ArtifactMixin, schema_version | ||
|
||
|
||
@dataclass | ||
class DependentProjects(dbtClassMixin): | ||
name: str | ||
environment: str | ||
|
||
|
||
@dataclass | ||
class Dependencies(dbtClassMixin): | ||
projects: list[DependentProjects] = field(default_factory=list) | ||
|
||
|
||
@dataclass | ||
class PublicationMetadata(BaseArtifactMetadata): | ||
dbt_schema_version: str = field(default_factory=lambda: str(Publication.dbt_schema_version)) | ||
adapter_type: Optional[str] = None | ||
quoting: Dict[str, Any] = field(default_factory=dict) | ||
|
||
|
||
@dataclass | ||
class PublicModel(dbtClassMixin): | ||
relation_name: str | ||
latest: bool = False # not implemented yet | ||
# list of model unique_ids | ||
public_dependencies: List[str] = field(default_factory=list) | ||
|
||
|
||
@dataclass | ||
class PublicationMandatory: | ||
project_name: str | ||
|
||
|
||
@dataclass | ||
@schema_version("publication", 1) | ||
class Publication(ArtifactMixin, PublicationMandatory): | ||
public_models: Dict[str, PublicModel] = field(default_factory=dict) | ||
metadata: PublicationMetadata = field(default_factory=PublicationMetadata) | ||
# list of project name strings | ||
dependencies: List[str] = field(default_factory=list) |
Oops, something went wrong.