From 53127daad83be7744c29ecadd9c5d69aa8273cde Mon Sep 17 00:00:00 2001 From: Kshitij Aranke Date: Wed, 11 Jan 2023 15:01:50 -0800 Subject: [PATCH] [CT-921] `dbt compile` works in click (#5545) (#6586) Co-authored-by: Github Build Bot resolves https://github.com/dbt-labs/dbt-core/issues/5545 --- .../Under the Hood-20230111-145143.yaml | 6 ++++++ core/dbt/cli/main.py | 9 +++++++-- .../docs/build/doctrees/environment.pickle | Bin 182190 -> 182098 bytes core/dbt/docs/build/html/genindex.html | 2 +- core/dbt/docs/build/html/index.html | 2 +- core/dbt/docs/build/html/search.html | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 .changes/unreleased/Under the Hood-20230111-145143.yaml diff --git a/.changes/unreleased/Under the Hood-20230111-145143.yaml b/.changes/unreleased/Under the Hood-20230111-145143.yaml new file mode 100644 index 00000000000..2f5c9c3fc1b --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230111-145143.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: '[CT-921] dbt compile works in click' +time: 2023-01-11T14:51:43.324107-08:00 +custom: + Author: aranke + Issue: "5545" diff --git a/core/dbt/cli/main.py b/core/dbt/cli/main.py index e47b6f58710..2d66733f37e 100644 --- a/core/dbt/cli/main.py +++ b/core/dbt/cli/main.py @@ -10,6 +10,7 @@ from dbt.config.profile import Profile from dbt.contracts.graph.manifest import Manifest from dbt.task.clean import CleanTask +from dbt.task.compile import CompileTask from dbt.task.deps import DepsTask from dbt.task.run import RunTask from dbt.task.test import TestTask @@ -210,8 +211,12 @@ def docs_serve(ctx, **kwargs): def compile(ctx, **kwargs): """Generates executable SQL from source, model, test, and analysis files. Compiled SQL files are written to the target/ directory.""" - click.echo(f"`{inspect.stack()[0][3]}` called\n flags: {ctx.obj['flags']}") - return None, True + config = RuntimeConfig.from_parts(ctx.obj["project"], ctx.obj["profile"], ctx.obj["flags"]) + task = CompileTask(ctx.obj["flags"], config) + + results = task.run() + success = task.interpret_results(results) + return results, success # dbt debug diff --git a/core/dbt/docs/build/doctrees/environment.pickle b/core/dbt/docs/build/doctrees/environment.pickle index 9c21016481a75defca177eac32ef285685f42bf1..6a2d234ffe5c0e955d6cd8258c3911cb82ac3cc8 100644 GIT binary patch delta 135 zcmZ42&wZ(ndqcB4>v@*dt$dq1qavaq`8~!0AQr82`b9 zb}CL540D_QK!izs`uX>azhUAx;NlwFwLUVMGr}Z(BS{?m#K_3YKDGTg0}xE#D8{5b Z{qcWBi|GX|Oi9x>6flWwoyD}{7yybUH$wmb diff --git a/core/dbt/docs/build/html/genindex.html b/core/dbt/docs/build/html/genindex.html index 6c5ed300f92..ceac455e800 100644 --- a/core/dbt/docs/build/html/genindex.html +++ b/core/dbt/docs/build/html/genindex.html @@ -87,7 +87,7 @@

Quick search

©2022, dbt Labs. | - Powered by Sphinx 6.1.2 + Powered by Sphinx 6.1.3 & Alabaster 0.7.12 diff --git a/core/dbt/docs/build/html/index.html b/core/dbt/docs/build/html/index.html index 0c532473a06..3253006b935 100644 --- a/core/dbt/docs/build/html/index.html +++ b/core/dbt/docs/build/html/index.html @@ -826,7 +826,7 @@

Quick search

©2022, dbt Labs. | - Powered by Sphinx 6.1.2 + Powered by Sphinx 6.1.3 & Alabaster 0.7.12 | diff --git a/core/dbt/docs/build/html/search.html b/core/dbt/docs/build/html/search.html index 006a67abd9b..e7a0040c970 100644 --- a/core/dbt/docs/build/html/search.html +++ b/core/dbt/docs/build/html/search.html @@ -106,7 +106,7 @@

Related Topics

©2022, dbt Labs. | - Powered by Sphinx 6.1.2 + Powered by Sphinx 6.1.3 & Alabaster 0.7.12