Skip to content

Commit 04c2ee9

Browse files
committed
WIP
1 parent 7b44ac7 commit 04c2ee9

File tree

1 file changed

+0
-74
lines changed

1 file changed

+0
-74
lines changed

src/dbt_core_interface/project.py

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -237,73 +237,6 @@ class WrappedDbtAdapterCompilationResponse:
237237
injected_code: t.Optional[str] = None
238238

239239

240-
class DbtTaskConfiguration:
241-
"""A container for task configuration with sane defaults.
242-
243-
Users should enforce an interface for their tasks via a factory method that returns an instance of this class.
244-
"""
245-
246-
def __init__(self, profile: str, target: str, **kwargs: t.Any) -> None:
247-
"""Initialize the task configuration."""
248-
self.profile: str = profile
249-
self.target: str = target
250-
self.kwargs: t.Dict[str, t.Any] = kwargs or {}
251-
self.threads: int = kwargs.get("threads", 1)
252-
self.single_threaded: bool = kwargs.get("single_threaded", self.threads == 1)
253-
self.state_id: t.Optional[str] = kwargs.get("state_id")
254-
self.version_check: bool = kwargs.get("version_check", False)
255-
self.resource_types: t.Optional[t.List[str]] = kwargs.get("resource_types")
256-
self.models: t.Union[None, str, t.List[str]] = kwargs.get("models")
257-
self.select: t.Union[None, str, t.List[str]] = kwargs.get("select")
258-
self.exclude: t.Union[None, str, t.List[str]] = kwargs.get("exclude")
259-
self.selector_name: t.Optional[str] = kwargs.get("selector_name")
260-
self.state: t.Optional[str] = kwargs.get("state")
261-
self.defer: bool = kwargs.get("defer", False)
262-
self.fail_fast: bool = kwargs.get("fail_fast", False)
263-
self.full_refresh: bool = kwargs.get("full_refresh", False)
264-
self.store_failures: bool = kwargs.get("store_failures", False)
265-
self.indirect_selection: bool = kwargs.get("indirect_selection", "eager")
266-
self.data: bool = kwargs.get("data", False)
267-
self.schema: bool = kwargs.get("schema", False)
268-
self.show: bool = kwargs.get("show", False)
269-
self.output: str = kwargs.get("output", "name")
270-
self.output_keys: t.Union[None, str, t.List[str]] = kwargs.get("output_keys")
271-
self.macro: t.Optional[str] = kwargs.get("macro")
272-
self.args: str = kwargs.get("args", "{}")
273-
self.quiet: bool = kwargs.get("quiet", True)
274-
275-
def __getattribute__(self, __name: str) -> t.Any:
276-
"""Force all attribute access to be lower case."""
277-
return object.__getattribute__(self, __name.lower())
278-
279-
def __getattr__(self, name: str) -> t.Any:
280-
"""Get an attribute from the kwargs if it does not exist on the class.
281-
282-
This is useful for passing through arbitrary arguments to dbt while still
283-
being able to manage some semblance of a sane interface with defaults.
284-
"""
285-
return self.kwargs.get(name)
286-
287-
@classmethod
288-
def from_runtime_config(cls, config: RuntimeConfig, **kwargs: t.Any) -> DbtTaskConfiguration:
289-
"""Create a task configuration container from a DbtProject's runtime config.
290-
291-
This is a good example of where static typing is not necessary. Developers can just
292-
pass in whatever they want and it will be passed through to the task configuration container.
293-
Users of the library are free to pass in any mapping derived from their own implementation for
294-
their own custom task.
295-
"""
296-
threads = kwargs.pop("threads", config.threads)
297-
kwargs.pop("single_threaded", None) # This is a derived property
298-
return cls(
299-
config.profile_name,
300-
config.target_name,
301-
threads=threads,
302-
single_threaded=threads == 1,
303-
**kwargs,
304-
)
305-
306-
307240
@t.final
308241
class DbtProject:
309242
"""Container for a dbt project.
@@ -814,13 +747,6 @@ def macro_parser(self) -> SqlMacroParser:
814747
self._macro_parser = SqlMacroParser(self.config, self.manifest)
815748
return self._macro_parser
816749

817-
def get_task_config(self, **kwargs) -> DbtTaskConfiguration:
818-
"""Get a dbt-core task configuration."""
819-
threads = kwargs.pop("threads", self.config.threads)
820-
return DbtTaskConfiguration.from_runtime_config(
821-
config=self.config, threads=threads, **kwargs
822-
)
823-
824750

825751
class DbtProjectContainer:
826752
"""Manages multiple DbtProjects.

0 commit comments

Comments
 (0)