diff --git a/CHANGELOG.md b/CHANGELOG.md index 933dee48471..87dc783f228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Allow `--defer` flag to `dbt snapshot` ([#4110](https://github.com/dbt-labs/dbt-core/issues/4110), [#4296](https://github.com/dbt-labs/dbt-core/pull/4296)) - Install prerelease packages when `version` explicitly references a prerelease version, regardless of `install-prerelease` status ([#4243](https://github.com/dbt-labs/dbt-core/issues/4243), [#4295](https://github.com/dbt-labs/dbt-core/pull/4295)) - Add data attributes to json log messages[#4301](https://github.com/dbt-labs/dbt-core/pull/4301) +- Add event codes to all log events([#4319](https://github.com/dbt-labs/dbt-core/pull/4319)) ### Fixes - Fix serialization error with missing quotes in metrics model ref ([#4252](https://github.com/dbt-labs/dbt-core/issues/4252), [#4287](https://github.com/dbt-labs/dbt-core/pull/4289)) diff --git a/core/dbt/clients/system.py b/core/dbt/clients/system.py index aa8b2cac2c9..68d3557ebf4 100644 --- a/core/dbt/clients/system.py +++ b/core/dbt/clients/system.py @@ -441,7 +441,7 @@ def run_cmd( fire_event(SystemStdErrMsg(bmsg=err)) if proc.returncode != 0: - fire_event(SystemReportReturnCode(code=proc.returncode)) + fire_event(SystemReportReturnCode(returncode=proc.returncode)) raise dbt.exceptions.CommandResultError(cwd, cmd, proc.returncode, out, err) diff --git a/core/dbt/events/base_types.py b/core/dbt/events/base_types.py index bbc78f858f6..628dcd7f9ff 100644 --- a/core/dbt/events/base_types.py +++ b/core/dbt/events/base_types.py @@ -1,4 +1,4 @@ -from abc import ABCMeta, abstractmethod +from abc import ABCMeta, abstractmethod, abstractproperty from dataclasses import dataclass from datetime import datetime import os @@ -58,6 +58,13 @@ class Event(metaclass=ABCMeta): ts: Optional[datetime] = None # use getter for non-optional pid: Optional[int] = None # use getter for non-optional + # four digit string code that uniquely identifies this type of event + # uniqueness and valid characters are enforced by tests + @abstractproperty + @staticmethod + def code() -> str: + raise Exception("code() not implemented for event") + # do not define this yourself. inherit it from one of the above level types. @abstractmethod def level_tag(self) -> str: diff --git a/core/dbt/events/test_types.py b/core/dbt/events/test_types.py index 1507faa8275..b62ac8a64a2 100644 --- a/core/dbt/events/test_types.py +++ b/core/dbt/events/test_types.py @@ -15,6 +15,7 @@ @dataclass class IntegrationTestInfo(InfoLevel, Cli): msg: str + code: str = "T001" def message(self) -> str: return f"Integration Test: {self.msg}" @@ -23,6 +24,7 @@ def message(self) -> str: @dataclass class IntegrationTestDebug(DebugLevel, Cli): msg: str + code: str = "T002" def message(self) -> str: return f"Integration Test: {self.msg}" @@ -31,6 +33,7 @@ def message(self) -> str: @dataclass class IntegrationTestWarn(WarnLevel, Cli): msg: str + code: str = "T003" def message(self) -> str: return f"Integration Test: {self.msg}" @@ -39,6 +42,7 @@ def message(self) -> str: @dataclass class IntegrationTestError(ErrorLevel, Cli): msg: str + code: str = "T004" def message(self) -> str: return f"Integration Test: {self.msg}" @@ -47,6 +51,7 @@ def message(self) -> str: @dataclass class IntegrationTestException(ShowException, ErrorLevel, Cli): msg: str + code: str = "T005" def message(self) -> str: return f"Integration Test: {self.msg}" diff --git a/core/dbt/events/types.py b/core/dbt/events/types.py index 38fb5630e38..c23b7833541 100644 --- a/core/dbt/events/types.py +++ b/core/dbt/events/types.py @@ -21,8 +21,26 @@ T_Event = TypeVar('T_Event', bound=Event) -# can't use ABCs with @dataclass because of https://github.com/python/mypy/issues/5374 -@dataclass +# Event codes have prefixes which follow this table +# +# | Code | Description | +# |:----:|:-------------------:| +# | A | Pre-project loading | +# | E | DB adapter | +# | I | Project parsing | +# | M | Deps generation | +# | Q | Node processing | +# | W | Node testing | +# | Y | Post processing | +# | Z | Misc | +# | T | Test only | +# +# The basic idea is that event codes roughly translate to the natural order of running a dbt task + +# TODO: remove ingore when this is fixed: +# https://github.com/python/mypy/issues/5374 + +@dataclass # type: ignore class AdapterEventBase(Cli, File): name: str base_msg: str @@ -49,23 +67,34 @@ def message(self) -> str: return f"{self.name} adapter: {msg}" +@dataclass class AdapterEventDebug(DebugLevel, AdapterEventBase, ShowException): + code: str = "E001" pass +@dataclass class AdapterEventInfo(InfoLevel, AdapterEventBase, ShowException): + code: str = "E002" pass +@dataclass class AdapterEventWarning(WarnLevel, AdapterEventBase, ShowException): + code: str = "E003" pass +@dataclass class AdapterEventError(ErrorLevel, AdapterEventBase, ShowException): + code: str = "E004" pass +@dataclass class MainKeyboardInterrupt(InfoLevel, Cli): + code: str = "Z001" + def message(self) -> str: return "ctrl-c" @@ -74,6 +103,7 @@ def message(self) -> str: @dataclass class MainEncounteredError(ErrorLevel, Cli): e: BaseException + code: str = "Z002" def message(self) -> str: return f"Encountered an error:\n{str(self.e)}" @@ -82,6 +112,7 @@ def message(self) -> str: @dataclass class MainStackTrace(DebugLevel, Cli): stack_trace: str + code: str = "Z003" def message(self) -> str: return self.stack_trace @@ -90,6 +121,7 @@ def message(self) -> str: @dataclass class MainReportVersion(InfoLevel, Cli, File): v: str # could be VersionSpecifier instead if we resolved some circular imports + code: str = "A001" def message(self): return f"Running with dbt{self.v}" @@ -98,6 +130,7 @@ def message(self): @dataclass class MainReportArgs(DebugLevel, Cli, File): args: argparse.Namespace + code: str = "A002" def message(self): return f"running dbt with arguments {str(self.args)}" @@ -106,52 +139,80 @@ def message(self): @dataclass class MainTrackingUserState(DebugLevel, Cli): user_state: str + code: str = "A003" def message(self): return f"Tracking: {self.user_state}" +@dataclass class ParsingStart(InfoLevel, Cli, File): + code: str = "I001" + def message(self) -> str: return "Start parsing." +@dataclass class ParsingCompiling(InfoLevel, Cli, File): + code: str = "I002" + def message(self) -> str: return "Compiling." +@dataclass class ParsingWritingManifest(InfoLevel, Cli, File): + code: str = "I003" + def message(self) -> str: return "Writing manifest." +@dataclass class ParsingDone(InfoLevel, Cli, File): + code: str = "I004" + def message(self) -> str: return "Done." +@dataclass class ManifestDependenciesLoaded(InfoLevel, Cli, File): + code: str = "I005" + def message(self) -> str: return "Dependencies loaded" +@dataclass class ManifestLoaderCreated(InfoLevel, Cli, File): + code: str = "I006" + def message(self) -> str: return "ManifestLoader created" +@dataclass class ManifestLoaded(InfoLevel, Cli, File): + code: str = "I007" + def message(self) -> str: return "Manifest loaded" +@dataclass class ManifestChecked(InfoLevel, Cli, File): + code: str = "I008" + def message(self) -> str: return "Manifest checked" +@dataclass class ManifestFlatGraphBuilt(InfoLevel, Cli, File): + code: str = "I009" + def message(self) -> str: return "Flat graph built" @@ -159,6 +220,7 @@ def message(self) -> str: @dataclass class ReportPerformancePath(InfoLevel, Cli, File): path: str + code: str = "I010" def message(self) -> str: return f"Performance info: {self.path}" @@ -167,6 +229,7 @@ def message(self) -> str: @dataclass class GitSparseCheckoutSubdirectory(DebugLevel, Cli, File): subdir: str + code: str = "M001" def message(self) -> str: return f" Subdirectory specified: {self.subdir}, using sparse checkout." @@ -175,6 +238,7 @@ def message(self) -> str: @dataclass class GitProgressCheckoutRevision(DebugLevel, Cli, File): revision: str + code: str = "M002" def message(self) -> str: return f" Checking out revision {self.revision}." @@ -183,6 +247,7 @@ def message(self) -> str: @dataclass class GitProgressUpdatingExistingDependency(DebugLevel, Cli, File): dir: str + code: str = "M003" def message(self) -> str: return f"Updating existing dependency {self.dir}." @@ -191,6 +256,7 @@ def message(self) -> str: @dataclass class GitProgressPullingNewDependency(DebugLevel, Cli, File): dir: str + code: str = "M004" def message(self) -> str: return f"Pulling new dependency {self.dir}." @@ -199,6 +265,7 @@ def message(self) -> str: @dataclass class GitNothingToDo(DebugLevel, Cli, File): sha: str + code: str = "M005" def message(self) -> str: return f"Already at {self.sha}, nothing to do." @@ -208,6 +275,7 @@ def message(self) -> str: class GitProgressUpdatedCheckoutRange(DebugLevel, Cli, File): start_sha: str end_sha: str + code: str = "M006" def message(self) -> str: return f" Updated checkout from {self.start_sha} to {self.end_sha}." @@ -216,6 +284,7 @@ def message(self) -> str: @dataclass class GitProgressCheckedOutAt(DebugLevel, Cli, File): end_sha: str + code: str = "M007" def message(self) -> str: return f" Checked out at {self.end_sha}." @@ -224,6 +293,7 @@ def message(self) -> str: @dataclass class RegistryProgressMakingGETRequest(DebugLevel, Cli, File): url: str + code: str = "M008" def message(self) -> str: return f"Making package registry request: GET {self.url}" @@ -233,6 +303,7 @@ def message(self) -> str: class RegistryProgressGETResponse(DebugLevel, Cli, File): url: str resp_code: int + code: str = "M009" def message(self) -> str: return f"Response from registry: GET {self.url} {self.resp_code}" @@ -242,6 +313,7 @@ def message(self) -> str: @dataclass class SystemErrorRetrievingModTime(ErrorLevel, Cli, File): path: str + code: str = "Z004" def message(self) -> str: return f"Error retrieving modification time for file {self.path}" @@ -252,6 +324,7 @@ class SystemCouldNotWrite(DebugLevel, Cli, File): path: str reason: str exc: Exception + code: str = "Z005" def message(self) -> str: return ( @@ -263,6 +336,7 @@ def message(self) -> str: @dataclass class SystemExecutingCmd(DebugLevel, Cli, File): cmd: List[str] + code: str = "Z006" def message(self) -> str: return f'Executing "{" ".join(self.cmd)}"' @@ -271,6 +345,7 @@ def message(self) -> str: @dataclass class SystemStdOutMsg(DebugLevel, Cli, File): bmsg: bytes + code: str = "Z007" def message(self) -> str: return f'STDOUT: "{str(self.bmsg)}"' @@ -279,6 +354,7 @@ def message(self) -> str: @dataclass class SystemStdErrMsg(DebugLevel, Cli, File): bmsg: bytes + code: str = "Z008" def message(self) -> str: return f'STDERR: "{str(self.bmsg)}"' @@ -286,15 +362,19 @@ def message(self) -> str: @dataclass class SystemReportReturnCode(DebugLevel, Cli, File): - code: int + returncode: int + code: str = "Z009" def message(self) -> str: - return f"command return code={self.code}" + return f"command return code={self.returncode}" + +# TODO remove?? Not called outside of this file @dataclass class SelectorAlertUpto3UnusedNodes(InfoLevel, Cli, File): node_names: List[str] + code: str = "I_NEED_A_CODE_5" def message(self) -> str: summary_nodes_str = ("\n - ").join(self.node_names[:3]) @@ -307,10 +387,13 @@ def message(self) -> str: f"\n - {summary_nodes_str}{and_more_str}" ) +# TODO remove?? Not called outside of this file + @dataclass class SelectorAlertAllUnusedNodes(DebugLevel, Cli, File): node_names: List[str] + code: str = "I_NEED_A_CODE_6" def message(self) -> str: debug_nodes_str = ("\n - ").join(self.node_names) @@ -325,6 +408,7 @@ class SelectorReportInvalidSelector(InfoLevel, Cli, File): selector_methods: dict spec_method: str raw_spec: str + code: str = "M010" def message(self) -> str: valid_selectors = ", ".join(self.selector_methods) @@ -337,6 +421,7 @@ def message(self) -> str: @dataclass class MacroEventInfo(InfoLevel, Cli, File): msg: str + code: str = "M011" def message(self) -> str: return self.msg @@ -345,6 +430,7 @@ def message(self) -> str: @dataclass class MacroEventDebug(DebugLevel, Cli, File): msg: str + code: str = "M012" def message(self) -> str: return self.msg @@ -354,6 +440,7 @@ def message(self) -> str: class NewConnection(DebugLevel, Cli, File): conn_type: str conn_name: str + code: str = "E001" def message(self) -> str: return f'Acquiring new {self.conn_type} connection "{self.conn_name}"' @@ -362,6 +449,7 @@ def message(self) -> str: @dataclass class ConnectionReused(DebugLevel, Cli, File): conn_name: str + code: str = "E002" def message(self) -> str: return f"Re-using an available connection from the pool (formerly {self.conn_name})" @@ -370,6 +458,7 @@ def message(self) -> str: @dataclass class ConnectionLeftOpen(DebugLevel, Cli, File): conn_name: Optional[str] + code: str = "E003" def message(self) -> str: return f"Connection '{self.conn_name}' was left open." @@ -378,6 +467,7 @@ def message(self) -> str: @dataclass class ConnectionClosed(DebugLevel, Cli, File): conn_name: Optional[str] + code: str = "E004" def message(self) -> str: return f"Connection '{self.conn_name}' was properly closed." @@ -386,6 +476,7 @@ def message(self) -> str: @dataclass class RollbackFailed(ShowException, DebugLevel, Cli, File): conn_name: Optional[str] + code: str = "E005" def message(self) -> str: return f"Failed to rollback '{self.conn_name}'" @@ -395,6 +486,7 @@ def message(self) -> str: @dataclass class ConnectionClosed2(DebugLevel, Cli, File): conn_name: Optional[str] + code: str = "E038" def message(self) -> str: return f"On {self.conn_name}: Close" @@ -404,6 +496,7 @@ def message(self) -> str: @dataclass class ConnectionLeftOpen2(DebugLevel, Cli, File): conn_name: Optional[str] + code: str = "E006" def message(self) -> str: return f"On {self.conn_name}: No close available on handle" @@ -412,6 +505,7 @@ def message(self) -> str: @dataclass class Rollback(DebugLevel, Cli, File): conn_name: Optional[str] + code: str = "E007" def message(self) -> str: return f"On {self.conn_name}: ROLLBACK" @@ -422,6 +516,7 @@ class CacheMiss(DebugLevel, Cli, File): conn_name: Any # TODO mypy says this is `Callable[[], str]`?? ¯\_(ツ)_/¯ database: Optional[str] schema: str + code: str = "E008" def message(self) -> str: return ( @@ -435,6 +530,7 @@ class ListRelations(DebugLevel, Cli, File): database: Optional[str] schema: str relations: List[BaseRelation] + code: str = "E009" def message(self) -> str: return f"with database={self.database}, schema={self.schema}, relations={self.relations}" @@ -444,6 +540,7 @@ def message(self) -> str: class ConnectionUsed(DebugLevel, Cli, File): conn_type: str conn_name: Optional[str] + code: str = "E010" def message(self) -> str: return f'Using {self.conn_type} connection "{self.conn_name}"' @@ -453,6 +550,7 @@ def message(self) -> str: class SQLQuery(DebugLevel, Cli, File): conn_name: Optional[str] sql: str + code: str = "E011" def message(self) -> str: return f"On {self.conn_name}: {self.sql}" @@ -462,6 +560,7 @@ def message(self) -> str: class SQLQueryStatus(DebugLevel, Cli, File): status: Union[AdapterResponse, str] elapsed: float + code: str = "E012" def message(self) -> str: return f"SQL status: {self.status} in {self.elapsed} seconds" @@ -470,6 +569,7 @@ def message(self) -> str: @dataclass class SQLCommit(DebugLevel, Cli, File): conn_name: str + code: str = "E013" def message(self) -> str: return f"On {self.conn_name}: COMMIT" @@ -480,6 +580,7 @@ class ColTypeChange(DebugLevel, Cli, File): orig_type: str new_type: str table: str + code: str = "E014" def message(self) -> str: return f"Changing col type from {self.orig_type} to {self.new_type} in table {self.table}" @@ -488,6 +589,7 @@ def message(self) -> str: @dataclass class SchemaCreation(DebugLevel, Cli, File): relation: BaseRelation + code: str = "E015" def message(self) -> str: return f'Creating schema "{self.relation}"' @@ -496,6 +598,7 @@ def message(self) -> str: @dataclass class SchemaDrop(DebugLevel, Cli, File): relation: BaseRelation + code: str = "E016" def message(self) -> str: return f'Dropping schema "{self.relation}".' @@ -507,6 +610,7 @@ def message(self) -> str: class UncachedRelation(DebugLevel, Cli, File): dep_key: _ReferenceKey ref_key: _ReferenceKey + code: str = "E017" def message(self) -> str: return ( @@ -520,6 +624,7 @@ def message(self) -> str: class AddLink(DebugLevel, Cli, File): dep_key: _ReferenceKey ref_key: _ReferenceKey + code: str = "E018" def message(self) -> str: return f"adding link, {self.dep_key} references {self.ref_key}" @@ -528,6 +633,7 @@ def message(self) -> str: @dataclass class AddRelation(DebugLevel, Cli, File): relation: _CachedRelation + code: str = "E019" def message(self) -> str: return f"Adding relation: {str(self.relation)}" @@ -536,6 +642,7 @@ def message(self) -> str: @dataclass class DropMissingRelation(DebugLevel, Cli, File): relation: _ReferenceKey + code: str = "E039" def message(self) -> str: return f"dropped a nonexistent relationship: {str(self.relation)}" @@ -545,6 +652,7 @@ def message(self) -> str: class DropCascade(DebugLevel, Cli, File): dropped: _ReferenceKey consequences: Set[_ReferenceKey] + code: str = "E020" def message(self) -> str: return f"drop {self.dropped} is cascading to {self.consequences}" @@ -553,6 +661,7 @@ def message(self) -> str: @dataclass class DropRelation(DebugLevel, Cli, File): dropped: _ReferenceKey + code: str = "E021" def message(self) -> str: return f"Dropping relation: {self.dropped}" @@ -563,6 +672,7 @@ class UpdateReference(DebugLevel, Cli, File): old_key: _ReferenceKey new_key: _ReferenceKey cached_key: _ReferenceKey + code: str = "E022" def message(self) -> str: return f"updated reference from {self.old_key} -> {self.cached_key} to "\ @@ -572,6 +682,7 @@ def message(self) -> str: @dataclass class TemporaryRelation(DebugLevel, Cli, File): key: _ReferenceKey + code: str = "E023" def message(self) -> str: return f"old key {self.key} not found in self.relations, assuming temporary" @@ -581,6 +692,7 @@ def message(self) -> str: class RenameSchema(DebugLevel, Cli, File): old_key: _ReferenceKey new_key: _ReferenceKey + code: str = "E024" def message(self) -> str: return f"Renaming relation {self.old_key} to {self.new_key}" @@ -589,6 +701,7 @@ def message(self) -> str: @dataclass class DumpBeforeAddGraph(DebugLevel, Cli, File): graph_func: Callable[[], Dict[str, List[str]]] + code: str = "E025" def message(self) -> str: # workaround for https://github.com/python/mypy/issues/6910 @@ -600,6 +713,7 @@ def message(self) -> str: @dataclass class DumpAfterAddGraph(DebugLevel, Cli, File): graph_func: Callable[[], Dict[str, List[str]]] + code: str = "E026" def message(self) -> str: # workaround for https://github.com/python/mypy/issues/6910 @@ -610,6 +724,7 @@ def message(self) -> str: @dataclass class DumpBeforeRenameSchema(DebugLevel, Cli, File): graph_func: Callable[[], Dict[str, List[str]]] + code: str = "E027" def message(self) -> str: # workaround for https://github.com/python/mypy/issues/6910 @@ -620,6 +735,7 @@ def message(self) -> str: @dataclass class DumpAfterRenameSchema(DebugLevel, Cli, File): graph_func: Callable[[], Dict[str, List[str]]] + code: str = "E028" def message(self) -> str: # workaround for https://github.com/python/mypy/issues/6910 @@ -630,6 +746,7 @@ def message(self) -> str: @dataclass class AdapterImportError(InfoLevel, Cli, File): exc: ModuleNotFoundError + code: str = "E029" def message(self) -> str: return f"Error importing adapter: {self.exc}" @@ -637,6 +754,8 @@ def message(self) -> str: @dataclass class PluginLoadError(ShowException, DebugLevel, Cli, File): + code: str = "E030" + def message(self): pass @@ -644,12 +763,16 @@ def message(self): @dataclass class NewConnectionOpening(DebugLevel, Cli, File): connection_state: str + code: str = "E031" def message(self) -> str: return f"Opening a new connection, currently in state {self.connection_state}" +@dataclass class TimingInfoCollected(DebugLevel, Cli, File): + code: str = "Z010" + def message(self) -> str: return "finished collecting timing info" @@ -658,6 +781,7 @@ def message(self) -> str: class MergedFromState(DebugLevel, Cli, File): nbr_merged: int sample: List + code: str = "A004" def message(self) -> str: return f"Merged {self.nbr_merged} items from state (sample: {self.sample})" @@ -667,6 +791,7 @@ def message(self) -> str: class MissingProfileTarget(InfoLevel, Cli, File): profile_name: str target_name: str + code: str = "A005" def message(self) -> str: return f"target not specified in profile '{self.profile_name}', using '{self.target_name}'" @@ -675,6 +800,7 @@ def message(self) -> str: @dataclass class ProfileLoadError(ShowException, DebugLevel, Cli, File): exc: Exception + code: str = "A006" def message(self) -> str: return f"Profile not loaded due to error: {self.exc}" @@ -683,20 +809,26 @@ def message(self) -> str: @dataclass class ProfileNotFound(InfoLevel, Cli, File): profile_name: Optional[str] + code: str = "A007" def message(self) -> str: return f'No profile "{self.profile_name}" found, continuing with no target' +@dataclass class InvalidVarsYAML(ErrorLevel, Cli, File): + code: str = "A008" + def message(self) -> str: return "The YAML provided in the --vars argument is not valid.\n" +# TODO: Remove? (appears to be uncalled) @dataclass class CatchRunException(ShowException, DebugLevel, Cli, File): build_path: Any exc: Exception + code: str = "I_NEED_A_CODE_1" def message(self) -> str: INTERNAL_ERROR_STRING = """This is an error in dbt. Please try again. If the \ @@ -711,19 +843,24 @@ def message(self) -> str: return error +# TODO: Remove? (appears to be uncalled) @dataclass class HandleInternalException(ShowException, DebugLevel, Cli, File): exc: Exception + code: str = "I_NEED_A_CODE_2" def message(self) -> str: return str(self.exc) +# TODO: Remove? (appears to be uncalled) + @dataclass class MessageHandleGenericException(ErrorLevel, Cli, File): build_path: str unique_id: str exc: Exception + code: str = "I_NEED_A_CODE_3" def message(self) -> str: node_description = self.build_path @@ -735,9 +872,13 @@ def message(self) -> str: error=str(self.exc).strip() ) +# TODO: Remove? (appears to be uncalled) + @dataclass class DetailsHandleGenericException(ShowException, DebugLevel, Cli, File): + code: str = "I_NEED_A_CODE_4" + def message(self) -> str: return '' @@ -745,6 +886,7 @@ def message(self) -> str: @dataclass class GenericTestFileParse(DebugLevel, Cli, File): path: str + code: str = "I011" def message(self) -> str: return f"Parsing {self.path}" @@ -753,12 +895,16 @@ def message(self) -> str: @dataclass class MacroFileParse(DebugLevel, Cli, File): path: str + code: str = "I012" def message(self) -> str: return f"Parsing {self.path}" +@dataclass class PartialParsingFullReparseBecauseOfError(InfoLevel, Cli, File): + code: str = "I013" + def message(self) -> str: return "Partial parsing enabled but an error occurred. Switching to a full re-parse." @@ -766,6 +912,7 @@ def message(self) -> str: @dataclass class PartialParsingExceptionFile(DebugLevel, Cli, File): file: str + code: str = "I014" def message(self) -> str: return f"Partial parsing exception processing file {self.file}" @@ -774,6 +921,7 @@ def message(self) -> str: @dataclass class PartialParsingFile(DebugLevel, Cli, File): file_dict: Dict + code: str = "I015" def message(self) -> str: return f"PP file: {self.file_dict}" @@ -782,27 +930,40 @@ def message(self) -> str: @dataclass class PartialParsingException(DebugLevel, Cli, File): exc_info: Dict + code: str = "I016" def message(self) -> str: return f"PP exception info: {self.exc_info}" +@dataclass class PartialParsingSkipParsing(DebugLevel, Cli, File): + code: str = "I017" + def message(self) -> str: return "Partial parsing enabled, no changes found, skipping parsing" +@dataclass class PartialParsingMacroChangeStartFullParse(InfoLevel, Cli, File): + code: str = "I018" + def message(self) -> str: return "Change detected to override macro used during parsing. Starting full parse." +@dataclass class PartialParsingProjectEnvVarsChanged(InfoLevel, Cli, File): + code: str = "I019" + def message(self) -> str: return "Unable to do partial parsing because env vars used in dbt_project.yml have changed" +@dataclass class PartialParsingProfileEnvVarsChanged(InfoLevel, Cli, File): + code: str = "I020" + def message(self) -> str: return "Unable to do partial parsing because env vars used in profiles.yml have changed" @@ -810,6 +971,7 @@ def message(self) -> str: @dataclass class PartialParsingDeletedMetric(DebugLevel, Cli, File): id: str + code: str = "I021" def message(self) -> str: return f"Partial parsing: deleted metric {self.id}" @@ -818,6 +980,7 @@ def message(self) -> str: @dataclass class ManifestWrongMetadataVersion(DebugLevel, Cli, File): version: str + code: str = "I022" def message(self) -> str: return ("Manifest metadata did not contain correct version. " @@ -828,6 +991,7 @@ def message(self) -> str: class PartialParsingVersionMismatch(InfoLevel, Cli, File): saved_version: str current_version: str + code: str = "I023" def message(self) -> str: return ("Unable to do partial parsing because of a dbt version mismatch. " @@ -835,28 +999,43 @@ def message(self) -> str: f"Current version: {self.current_version}.") +@dataclass class PartialParsingFailedBecauseConfigChange(InfoLevel, Cli, File): + code: str = "I024" + def message(self) -> str: return ("Unable to do partial parsing because config vars, " "config profile, or config target have changed") +@dataclass class PartialParsingFailedBecauseProfileChange(InfoLevel, Cli, File): + code: str = "I025" + def message(self) -> str: return ("Unable to do partial parsing because profile has changed") +@dataclass class PartialParsingFailedBecauseNewProjectDependency(InfoLevel, Cli, File): + code: str = "I026" + def message(self) -> str: return ("Unable to do partial parsing because a project dependency has been added") +@dataclass class PartialParsingFailedBecauseHashChanged(InfoLevel, Cli, File): + code: str = "I027" + def message(self) -> str: return ("Unable to do partial parsing because a project config has changed") +@dataclass class PartialParsingNotEnabled(DebugLevel, Cli, File): + code: str = "I028" + def message(self) -> str: return ("Partial parsing not enabled") @@ -865,12 +1044,16 @@ def message(self) -> str: class ParsedFileLoadFailed(ShowException, DebugLevel, Cli, File): path: str exc: Exception + code: str = "I029" def message(self) -> str: return f"Failed to load parsed file from disk at {self.path}: {self.exc}" +@dataclass class PartialParseSaveFileNotFound(InfoLevel, Cli, File): + code: str = "I030" + def message(self) -> str: return ("Partial parse save file not found. Starting full parse.") @@ -878,6 +1061,7 @@ def message(self) -> str: @dataclass class StaticParserCausedJinjaRendering(DebugLevel, Cli, File): path: str + code: str = "I031" def message(self) -> str: return f"1605: jinja rendering because of STATIC_PARSER flag. file: {self.path}" @@ -888,6 +1072,7 @@ def message(self) -> str: @dataclass class UsingExperimentalParser(DebugLevel, Cli, File): path: str + code: str = "I032" def message(self) -> str: return f"1610: conducting experimental parser sample on {self.path}" @@ -896,6 +1081,7 @@ def message(self) -> str: @dataclass class SampleFullJinjaRendering(DebugLevel, Cli, File): path: str + code: str = "I033" def message(self) -> str: return f"1611: conducting full jinja rendering sample on {self.path}" @@ -904,6 +1090,7 @@ def message(self) -> str: @dataclass class StaticParserFallbackJinjaRendering(DebugLevel, Cli, File): path: str + code: str = "I034" def message(self) -> str: return f"1602: parser fallback to jinja rendering on {self.path}" @@ -912,6 +1099,7 @@ def message(self) -> str: @dataclass class StaticParsingMacroOverrideDetected(DebugLevel, Cli, File): path: str + code: str = "I035" def message(self) -> str: return f"1601: detected macro override of ref/source/config in the scope of {self.path}" @@ -920,6 +1108,7 @@ def message(self) -> str: @dataclass class StaticParserSuccess(DebugLevel, Cli, File): path: str + code: str = "I036" def message(self) -> str: return f"1699: static parser successfully parsed {self.path}" @@ -928,6 +1117,7 @@ def message(self) -> str: @dataclass class StaticParserFailure(DebugLevel, Cli, File): path: str + code: str = "I037" def message(self) -> str: return f"1603: static parser failed on {self.path}" @@ -936,6 +1126,7 @@ def message(self) -> str: @dataclass class ExperimentalParserSuccess(DebugLevel, Cli, File): path: str + code: str = "I038" def message(self) -> str: return f"1698: experimental parser successfully parsed {self.path}" @@ -944,6 +1135,7 @@ def message(self) -> str: @dataclass class ExperimentalParserFailure(DebugLevel, Cli, File): path: str + code: str = "I039" def message(self) -> str: return f"1604: experimental parser failed on {self.path}" @@ -954,6 +1146,7 @@ class PartialParsingEnabled(DebugLevel, Cli, File): deleted: int added: int changed: int + code: str = "I040" def message(self) -> str: return (f"Partial parsing enabled: " @@ -965,6 +1158,7 @@ def message(self) -> str: @dataclass class PartialParsingAddedFile(DebugLevel, Cli, File): file_id: str + code: str = "I041" def message(self) -> str: return f"Partial parsing: added file: {self.file_id}" @@ -973,6 +1167,7 @@ def message(self) -> str: @dataclass class PartialParsingDeletedFile(DebugLevel, Cli, File): file_id: str + code: str = "I042" def message(self) -> str: return f"Partial parsing: deleted file: {self.file_id}" @@ -981,6 +1176,7 @@ def message(self) -> str: @dataclass class PartialParsingUpdatedFile(DebugLevel, Cli, File): file_id: str + code: str = "I043" def message(self) -> str: return f"Partial parsing: updated file: {self.file_id}" @@ -989,6 +1185,7 @@ def message(self) -> str: @dataclass class PartialParsingNodeMissingInSourceFile(DebugLevel, Cli, File): source_file: str + code: str = "I044" def message(self) -> str: return f"Partial parsing: node not found for source_file {self.source_file}" @@ -997,6 +1194,7 @@ def message(self) -> str: @dataclass class PartialParsingMissingNodes(DebugLevel, Cli, File): file_id: str + code: str = "I045" def message(self) -> str: return f"No nodes found for source file {self.file_id}" @@ -1005,6 +1203,7 @@ def message(self) -> str: @dataclass class PartialParsingChildMapMissingUniqueID(DebugLevel, Cli, File): unique_id: str + code: str = "I046" def message(self) -> str: return f"Partial parsing: {self.unique_id} not found in child_map" @@ -1013,6 +1212,7 @@ def message(self) -> str: @dataclass class PartialParsingUpdateSchemaFile(DebugLevel, Cli, File): file_id: str + code: str = "I047" def message(self) -> str: return f"Partial parsing: update schema file: {self.file_id}" @@ -1021,6 +1221,7 @@ def message(self) -> str: @dataclass class PartialParsingDeletedSource(DebugLevel, Cli, File): unique_id: str + code: str = "I048" def message(self) -> str: return f"Partial parsing: deleted source {self.unique_id}" @@ -1029,6 +1230,7 @@ def message(self) -> str: @dataclass class PartialParsingDeletedExposure(DebugLevel, Cli, File): unique_id: str + code: str = "I049" def message(self) -> str: return f"Partial parsing: deleted exposure {self.unique_id}" @@ -1037,6 +1239,7 @@ def message(self) -> str: @dataclass class InvalidDisabledSourceInTestNode(WarnLevel, Cli, File): msg: str + code: str = "I050" def message(self) -> str: return ui.warning_tag(self.msg) @@ -1045,6 +1248,7 @@ def message(self) -> str: @dataclass class InvalidRefInTestNode(WarnLevel, Cli, File): msg: str + code: str = "I051" def message(self) -> str: return ui.warning_tag(self.msg) @@ -1053,6 +1257,7 @@ def message(self) -> str: @dataclass class RunningOperationCaughtError(ErrorLevel, Cli, File): exc: Exception + code: str = "Q001" def message(self) -> str: return f'Encountered an error while running operation: {self.exc}' @@ -1061,12 +1266,16 @@ def message(self) -> str: @dataclass class RunningOperationUncaughtError(ErrorLevel, Cli, File): exc: Exception + code: str = "W001" def message(self) -> str: return f'Encountered an error while running operation: {self.exc}' +@dataclass class DbtProjectError(ErrorLevel, Cli, File): + code: str = "A009" + def message(self) -> str: return "Encountered an error while reading the project:" @@ -1074,12 +1283,16 @@ def message(self) -> str: @dataclass class DbtProjectErrorException(ErrorLevel, Cli, File): exc: Exception + code: str = "A010" def message(self) -> str: return f" ERROR: {str(self.exc)}" +@dataclass class DbtProfileError(ErrorLevel, Cli, File): + code: str = "A011" + def message(self) -> str: return "Encountered an error while reading profiles:" @@ -1087,12 +1300,16 @@ def message(self) -> str: @dataclass class DbtProfileErrorException(ErrorLevel, Cli, File): exc: Exception + code: str = "A012" def message(self) -> str: return f" ERROR: {str(self.exc)}" +@dataclass class ProfileListTitle(InfoLevel, Cli, File): + code: str = "A013" + def message(self) -> str: return "Defined profiles:" @@ -1100,17 +1317,24 @@ def message(self) -> str: @dataclass class ListSingleProfile(InfoLevel, Cli, File): profile: str + code: str = "A014" def message(self) -> str: return f" - {self.profile}" +@dataclass class NoDefinedProfiles(InfoLevel, Cli, File): + code: str = "A015" + def message(self) -> str: return "There are no profiles defined in your profiles.yml file" +@dataclass class ProfileHelpMessage(InfoLevel, Cli, File): + code: str = "A016" + def message(self) -> str: PROFILES_HELP_MESSAGE = """ For more information on configuring profiles, please consult the dbt docs: @@ -1123,6 +1347,7 @@ def message(self) -> str: @dataclass class CatchableExceptionOnRun(ShowException, DebugLevel, Cli, File): exc: Exception + code: str = "W002" def message(self) -> str: return str(self.exc) @@ -1132,6 +1357,7 @@ def message(self) -> str: class InternalExceptionOnRun(DebugLevel, Cli, File): build_path: str exc: Exception + code: str = "W003" def message(self) -> str: prefix = 'Internal error executing {}'.format(self.build_path) @@ -1151,6 +1377,8 @@ def message(self) -> str: # at the error level - or whatever other level chosen. Used in multiple places. @dataclass class PrintDebugStackTrace(ShowException, DebugLevel, Cli, File): + code: str = "Z011" + def message(self) -> str: return "" @@ -1160,6 +1388,7 @@ class GenericExceptionOnRun(ErrorLevel, Cli, File): build_path: str unique_id: str exc: Exception + code: str = "W004" def message(self) -> str: node_description = self.build_path @@ -1176,6 +1405,7 @@ def message(self) -> str: class NodeConnectionReleaseError(ShowException, DebugLevel, Cli, File): node_name: str exc: Exception + code: str = "W005" def message(self) -> str: return ('Error releasing connection for node {}: {!s}' @@ -1185,6 +1415,7 @@ def message(self) -> str: @dataclass class CheckCleanPath(InfoLevel, Cli): path: str + code: str = "Z012" def message(self) -> str: return f"Checking {self.path}/*" @@ -1194,6 +1425,8 @@ def message(self) -> str: class ConfirmCleanPath(InfoLevel, Cli): path: str + code: str = "Z013" + def message(self) -> str: return f"Cleaned {self.path}/*" @@ -1201,12 +1434,16 @@ def message(self) -> str: @dataclass class ProtectedCleanPath(InfoLevel, Cli): path: str + code: str = "Z014" def message(self) -> str: return f"ERROR: not cleaning {self.path}/* because it is protected" +@dataclass class FinishedCleanPaths(InfoLevel, Cli): + code: str = "Z015" + def message(self) -> str: return "Finished cleaning all paths." @@ -1215,6 +1452,7 @@ def message(self) -> str: class OpenCommand(InfoLevel, Cli, File): open_cmd: str profiles_dir: str + code: str = "Z016" def message(self) -> str: PROFILE_DIR_MESSAGE = """To view your profiles.yml file, run: @@ -1228,7 +1466,10 @@ def message(self) -> str: return message +@dataclass class DepsNoPackagesFound(InfoLevel, Cli, File): + code: str = "M013" + def message(self) -> str: return 'Warning: No packages were found in packages.yml' @@ -1236,6 +1477,7 @@ def message(self) -> str: @dataclass class DepsStartPackageInstall(InfoLevel, Cli, File): package: str + code: str = "M014" def message(self) -> str: return f"Installing {self.package}" @@ -1244,6 +1486,7 @@ def message(self) -> str: @dataclass class DepsInstallInfo(InfoLevel, Cli, File): version_name: str + code: str = "M015" def message(self) -> str: return f" Installed from {self.version_name}" @@ -1252,12 +1495,16 @@ def message(self) -> str: @dataclass class DepsUpdateAvailable(InfoLevel, Cli, File): version_latest: str + code: str = "M016" def message(self) -> str: return f" Updated version available: {self.version_latest}" +@dataclass class DepsUTD(InfoLevel, Cli, File): + code: str = "M017" + def message(self) -> str: return " Up to date!" @@ -1265,6 +1512,7 @@ def message(self) -> str: @dataclass class DepsListSubdirectory(InfoLevel, Cli, File): subdirectory: str + code: str = "M018" def message(self) -> str: return f" and subdirectory {self.subdirectory}" @@ -1273,6 +1521,7 @@ def message(self) -> str: @dataclass class DepsNotifyUpdatesAvailable(InfoLevel, Cli, File): packages: List[str] + code: str = "M019" def message(self) -> str: return ('\nUpdates available for packages: {} \ @@ -1282,12 +1531,16 @@ def message(self) -> str: @dataclass class DatabaseErrorRunning(InfoLevel, Cli, File): hook_type: str + code: str = "E040" def message(self) -> str: return f"Database error while running {self.hook_type}" +@dataclass class EmptyLine(InfoLevel, Cli, File): + code: str = "Z017" + def message(self) -> str: return '' @@ -1296,6 +1549,7 @@ def message(self) -> str: class HooksRunning(InfoLevel, Cli, File): num_hooks: int hook_type: str + code: str = "E032" def message(self) -> str: plural = 'hook' if self.num_hooks == 1 else 'hooks' @@ -1306,6 +1560,7 @@ def message(self) -> str: class HookFinished(InfoLevel, Cli, File): stat_line: str execution: str + code: str = "E033" def message(self) -> str: return f"Finished running {self.stat_line}{self.execution}." @@ -1314,6 +1569,7 @@ def message(self) -> str: @dataclass class WriteCatalogFailure(ErrorLevel, Cli, File): num_exceptions: int + code: str = "E034" def message(self) -> str: return (f"dbt encountered {self.num_exceptions} failure{(self.num_exceptions != 1) * 's'} " @@ -1323,27 +1579,40 @@ def message(self) -> str: @dataclass class CatalogWritten(InfoLevel, Cli, File): path: str + code: str = "E035" def message(self) -> str: return f"Catalog written to {self.path}" +@dataclass class CannotGenerateDocs(InfoLevel, Cli, File): + code: str = "E036" + def message(self) -> str: return "compile failed, cannot generate docs" +@dataclass class BuildingCatalog(InfoLevel, Cli, File): + code: str = "E037" + def message(self) -> str: return "Building catalog" +@dataclass class CompileComplete(InfoLevel, Cli, File): + code: str = "Q002" + def message(self) -> str: return "Done." +@dataclass class FreshnessCheckComplete(InfoLevel, Cli, File): + code: str = "Q003" + def message(self) -> str: return "Done." @@ -1352,6 +1621,7 @@ def message(self) -> str: class ServingDocsPort(InfoLevel, Cli, File): address: str port: int + code: str = "Z018" def message(self) -> str: return f"Serving docs at {self.address}:{self.port}" @@ -1360,12 +1630,16 @@ def message(self) -> str: @dataclass class ServingDocsAccessInfo(InfoLevel, Cli, File): port: str + code: str = "Z019" def message(self) -> str: return f"To access from your browser, navigate to: http://localhost:{self.port}" +@dataclass class ServingDocsExitInfo(InfoLevel, Cli, File): + code: str = "Z020" + def message(self) -> str: return "Press Ctrl+C to exit.\n\n" @@ -1373,6 +1647,7 @@ def message(self) -> str: @dataclass class SeedHeader(InfoLevel, Cli, File): header: str + code: str = "Q004" def message(self) -> str: return self.header @@ -1381,6 +1656,7 @@ def message(self) -> str: @dataclass class SeedHeaderSeperator(InfoLevel, Cli, File): len_header: int + code: str = "Q005" def message(self) -> str: return "-" * self.len_header @@ -1391,6 +1667,7 @@ class RunResultWarning(WarnLevel, Cli, File): resource_type: str node_name: str path: str + code: str = "Z021" def message(self) -> str: info = 'Warning' @@ -1402,6 +1679,7 @@ class RunResultFailure(ErrorLevel, Cli, File): resource_type: str node_name: str path: str + code: str = "Z022" def message(self) -> str: info = 'Failure' @@ -1411,6 +1689,7 @@ def message(self) -> str: @dataclass class StatsLine(InfoLevel, Cli, File): stats: Dict + code: str = "Z023" def message(self) -> str: stats_line = ("\nDone. PASS={pass} WARN={warn} ERROR={error} SKIP={skip} TOTAL={total}") @@ -1420,6 +1699,7 @@ def message(self) -> str: @dataclass class RunResultError(ErrorLevel, Cli, File): msg: str + code: str = "Z024" def message(self) -> str: return f" {self.msg}" @@ -1428,6 +1708,7 @@ def message(self) -> str: @dataclass class RunResultErrorNoMessage(ErrorLevel, Cli, File): status: str + code: str = "Z025" def message(self) -> str: return f" Status: {self.status}" @@ -1436,6 +1717,7 @@ def message(self) -> str: @dataclass class SQLCompiledPath(InfoLevel, Cli, File): path: str + code: str = "Z026" def message(self) -> str: return f" compiled SQL at {self.path}" @@ -1444,6 +1726,7 @@ def message(self) -> str: @dataclass class SQlRunnerException(ShowException, DebugLevel, Cli, File): exc: Exception + code: str = "Q006" def message(self) -> str: return f"Got an exception: {self.exc}" @@ -1452,6 +1735,7 @@ def message(self) -> str: @dataclass class CheckNodeTestFailure(InfoLevel, Cli, File): relation_name: str + code: str = "Z027" def message(self) -> str: msg = f"select * from {self.relation_name}" @@ -1462,6 +1746,7 @@ def message(self) -> str: @dataclass class FirstRunResultError(ErrorLevel, Cli, File): msg: str + code: str = "Z028" def message(self) -> str: return ui.yellow(self.msg) @@ -1470,6 +1755,7 @@ def message(self) -> str: @dataclass class AfterFirstRunResultError(ErrorLevel, Cli, File): msg: str + code: str = "Z029" def message(self) -> str: return self.msg @@ -1480,6 +1766,7 @@ class EndOfRunSummary(InfoLevel, Cli, File): num_errors: int num_warnings: int keyboard_interrupt: bool = False + code: str = "Z030" def message(self) -> str: error_plural = pluralize(self.num_errors, 'error') @@ -1501,6 +1788,7 @@ class PrintStartLine(InfoLevel, Cli, File): description: str index: int total: int + code: str = "Z031" def message(self) -> str: msg = f"START {self.description}" @@ -1513,6 +1801,7 @@ class PrintHookStartLine(InfoLevel, Cli, File): index: int total: int truncate: bool + code: str = "Z032" def message(self) -> str: msg = f"START hook: {self.statement}" @@ -1531,6 +1820,7 @@ class PrintHookEndLine(InfoLevel, Cli, File): total: int execution_time: int truncate: bool + code: str = "Q007" def message(self) -> str: msg = 'OK hook: {}'.format(self.statement) @@ -1549,6 +1839,7 @@ class SkippingDetails(InfoLevel, Cli, File): node_name: str index: int total: int + code: str = "Z034" def message(self) -> str: if self.resource_type in NodeType.refable(): @@ -1567,6 +1858,7 @@ class PrintErrorTestResult(ErrorLevel, Cli, File): index: int num_models: int execution_time: int + code: str = "Q008" def message(self) -> str: info = "ERROR" @@ -1584,6 +1876,7 @@ class PrintPassTestResult(InfoLevel, Cli, File): index: int num_models: int execution_time: int + code: str = "Q009" def message(self) -> str: info = "PASS" @@ -1602,6 +1895,7 @@ class PrintWarnTestResult(WarnLevel, Cli, File): num_models: int execution_time: int failures: List[str] + code: str = "Q010" def message(self) -> str: info = f'WARN {self.failures}' @@ -1620,6 +1914,7 @@ class PrintFailureTestResult(ErrorLevel, Cli, File): num_models: int execution_time: int failures: List[str] + code: str = "Q011" def message(self) -> str: info = f'FAIL {self.failures}' @@ -1637,6 +1932,7 @@ class PrintSkipBecauseError(ErrorLevel, Cli, File): relation: str index: int total: int + code: str = "Z035" def message(self) -> str: msg = f'SKIP relation {self.schema}.{self.relation} due to ephemeral model error' @@ -1653,6 +1949,7 @@ class PrintModelErrorResultLine(ErrorLevel, Cli, File): index: int total: int execution_time: int + code: str = "Z036" def message(self) -> str: info = "ERROR creating" @@ -1671,6 +1968,7 @@ class PrintModelResultLine(InfoLevel, Cli, File): index: int total: int execution_time: int + code: str = "Q012" def message(self) -> str: info = "OK created" @@ -1690,6 +1988,7 @@ class PrintSnapshotErrorResultLine(ErrorLevel, Cli, File): index: int total: int execution_time: int + code: str = "Q013" def message(self) -> str: info = 'ERROR snapshotting' @@ -1709,6 +2008,7 @@ class PrintSnapshotResultLine(InfoLevel, Cli, File): index: int total: int execution_time: int + code: str = "Q014" def message(self) -> str: info = 'OK snapshotted' @@ -1728,6 +2028,7 @@ class PrintSeedErrorResultLine(ErrorLevel, Cli, File): execution_time: int schema: str relation: str + code: str = "Q015" def message(self) -> str: info = 'ERROR loading' @@ -1747,6 +2048,7 @@ class PrintSeedResultLine(InfoLevel, Cli, File): execution_time: int schema: str relation: str + code: str = "Q016" def message(self) -> str: info = 'OK loaded' @@ -1765,6 +2067,7 @@ class PrintHookEndErrorLine(ErrorLevel, Cli, File): index: int total: int execution_time: int + code: str = "Q017" def message(self) -> str: info = 'ERROR' @@ -1783,6 +2086,7 @@ class PrintHookEndErrorStaleLine(ErrorLevel, Cli, File): index: int total: int execution_time: int + code: str = "Q018" def message(self) -> str: info = 'ERROR STALE' @@ -1801,6 +2105,7 @@ class PrintHookEndWarnLine(WarnLevel, Cli, File): index: int total: int execution_time: int + code: str = "Q019" def message(self) -> str: info = 'WARN' @@ -1819,6 +2124,7 @@ class PrintHookEndPassLine(InfoLevel, Cli, File): index: int total: int execution_time: int + code: str = "Q020" def message(self) -> str: info = 'PASS' @@ -1833,6 +2139,7 @@ def message(self) -> str: @dataclass class PrintCancelLine(ErrorLevel, Cli, File): conn_name: str + code: str = "Q021" def message(self) -> str: msg = 'CANCEL query {}'.format(self.conn_name) @@ -1845,6 +2152,7 @@ def message(self) -> str: @dataclass class DefaultSelector(InfoLevel, Cli, File): name: str + code: str = "Q022" def message(self) -> str: return f"Using default selector {self.name}" @@ -1853,6 +2161,7 @@ def message(self) -> str: @dataclass class NodeStart(DebugLevel, Cli, File): unique_id: str + code: str = "Q023" def message(self) -> str: return f"Began running node {self.unique_id}" @@ -1861,6 +2170,7 @@ def message(self) -> str: @dataclass class NodeFinished(DebugLevel, Cli, File): unique_id: str + code: str = "Q024" def message(self) -> str: return f"Finished running node {self.unique_id}" @@ -1869,6 +2179,7 @@ def message(self) -> str: @dataclass class QueryCancelationUnsupported(InfoLevel, Cli, File): type: str + code: str = "Q025" def message(self) -> str: msg = (f"The {self.type} adapter does not support query " @@ -1880,6 +2191,7 @@ def message(self) -> str: @dataclass class ConcurrencyLine(InfoLevel, Cli, File): concurrency_line: str + code: str = "Q026" def message(self) -> str: return self.concurrency_line @@ -1888,6 +2200,7 @@ def message(self) -> str: @dataclass class StarterProjectPath(DebugLevel, Cli, File): dir: str + code: str = "A017" def message(self) -> str: return f"Starter project path: {self.dir}" @@ -1896,6 +2209,7 @@ def message(self) -> str: @dataclass class ConfigFolderDirectory(InfoLevel, Cli, File): dir: str + code: str = "A018" def message(self) -> str: return f"Creating dbt configuration folder at {self.dir}" @@ -1904,6 +2218,7 @@ def message(self) -> str: @dataclass class NoSampleProfileFound(InfoLevel, Cli, File): adapter: str + code: str = "A019" def message(self) -> str: return f"No sample profile found for {self.adapter}." @@ -1913,6 +2228,7 @@ def message(self) -> str: class ProfileWrittenWithSample(InfoLevel, Cli, File): name: str path: str + code: str = "A020" def message(self) -> str: return (f"Profile {self.name} written to {self.path} " @@ -1924,6 +2240,7 @@ def message(self) -> str: class ProfileWrittenWithTargetTemplateYAML(InfoLevel, Cli, File): name: str path: str + code: str = "A021" def message(self) -> str: return (f"Profile {self.name} written to {self.path} using target's " @@ -1935,6 +2252,7 @@ def message(self) -> str: class ProfileWrittenWithProjectTemplateYAML(InfoLevel, Cli, File): name: str path: str + code: str = "A022" def message(self) -> str: return (f"Profile {self.name} written to {self.path} using project's " @@ -1942,12 +2260,18 @@ def message(self) -> str: "validate the connection.") +@dataclass class SettingUpProfile(InfoLevel, Cli, File): + code: str = "A023" + def message(self) -> str: return "Setting up your profile." +@dataclass class InvalidProfileTemplateYAML(InfoLevel, Cli, File): + code: str = "A024" + def message(self) -> str: return "Invalid profile_template.yml in project." @@ -1955,6 +2279,7 @@ def message(self) -> str: @dataclass class ProjectNameAlreadyExists(InfoLevel, Cli, File): name: str + code: str = "A025" def message(self) -> str: return f"A project called {self.name} already exists here." @@ -1963,6 +2288,7 @@ def message(self) -> str: @dataclass class GetAddendum(InfoLevel, Cli, File): msg: str + code: str = "A026" def message(self) -> str: return self.msg @@ -1971,24 +2297,34 @@ def message(self) -> str: @dataclass class DepsSetDownloadDirectory(DebugLevel, Cli, File): path: str + code: str = "A027" def message(self) -> str: return f"Set downloads directory='{self.path}'" +@dataclass class EnsureGitInstalled(ErrorLevel, Cli, File): + code: str = "Z037" + def message(self) -> str: return ('Make sure git is installed on your machine. More ' 'information: ' 'https://docs.getdbt.com/docs/package-management') +@dataclass class DepsCreatingLocalSymlink(DebugLevel, Cli, File): + code: str = "Z038" + def message(self) -> str: return ' Creating symlink to local dependency.' +@dataclass class DepsSymlinkNotAvailable(DebugLevel, Cli, File): + code: str = "Z039" + def message(self) -> str: return ' Symlinks are not available on this OS, copying dependency.' @@ -1996,6 +2332,7 @@ def message(self) -> str: @dataclass class FoundStats(InfoLevel, Cli, File): stat_line: str + code: str = "W006" def message(self) -> str: return f"Found {self.stat_line}" @@ -2004,6 +2341,7 @@ def message(self) -> str: @dataclass class CompilingNode(DebugLevel, Cli, File): unique_id: str + code: str = "Q027" def message(self) -> str: return f"Compiling {self.unique_id}" @@ -2012,12 +2350,16 @@ def message(self) -> str: @dataclass class WritingInjectedSQLForNode(DebugLevel, Cli, File): unique_id: str + code: str = "Q028" def message(self) -> str: return f'Writing injected SQL for node "{self.unique_id}"' +@dataclass class DisableTracking(WarnLevel, Cli, File): + code: str = "Z040" + def message(self) -> str: return "Error sending message, disabling tracking" @@ -2025,27 +2367,40 @@ def message(self) -> str: @dataclass class SendingEvent(DebugLevel, Cli): kwargs: str + code: str = "Z041" def message(self) -> str: return f"Sending event: {self.kwargs}" +@dataclass class SendEventFailure(DebugLevel, Cli, File): + code: str = "Z042" + def message(self) -> str: return "An error was encountered while trying to send an event" +@dataclass class FlushEvents(DebugLevel, Cli): + code: str = "Z043" + def message(self) -> str: return "Flushing usage events" +@dataclass class FlushEventsFailure(DebugLevel, Cli): + code: str = "Z044" + def message(self) -> str: return "An error was encountered while trying to flush usage events" +@dataclass class TrackingInitializeFailure(ShowException, DebugLevel, Cli, File): + code: str = "Z045" + def message(self) -> str: return "Got an exception trying to initialize tracking" @@ -2054,6 +2409,7 @@ def message(self) -> str: class RetryExternalCall(DebugLevel, Cli, File): attempt: int max: int + code: str = "Z046" def message(self) -> str: return f"Retrying external call. Attempt: {self.attempt} Max attempts: {self.max}" @@ -2063,6 +2419,7 @@ def message(self) -> str: class GeneralWarningMsg(WarnLevel, Cli, File): msg: str log_fmt: str + code: str = "Z047" def message(self) -> str: if self.log_fmt is not None: @@ -2074,6 +2431,7 @@ def message(self) -> str: class GeneralWarningException(WarnLevel, Cli, File): exc: Exception log_fmt: str + code: str = "Z048" def message(self) -> str: if self.log_fmt is not None: @@ -2119,7 +2477,6 @@ def dump_callable(): SystemExecutingCmd(cmd=[""]) SystemStdOutMsg(bmsg=b"") SystemStdErrMsg(bmsg=b"") - SystemReportReturnCode(code=0) SelectorReportInvalidSelector( selector_methods={"": ""}, spec_method="", raw_spec="" ) @@ -2185,7 +2542,7 @@ def dump_callable(): SystemExecutingCmd(cmd=['']) SystemStdOutMsg(bmsg=b'') SystemStdErrMsg(bmsg=b'') - SystemReportReturnCode(code=0) + SystemReportReturnCode(returncode=0) SelectorAlertUpto3UnusedNodes(node_names=[]) SelectorAlertAllUnusedNodes(node_names=[]) SelectorReportInvalidSelector(selector_methods={'': ''}, spec_method='', raw_spec='')