|
8 | 8 | import functools |
9 | 9 |
|
10 | 10 |
|
11 | | -def _get_dbt_operations(ctx: click.Context, vars: t.Optional[t.Dict[str, t.Any]]) -> DbtOperations: |
| 11 | +def _get_dbt_operations( |
| 12 | + ctx: click.Context, vars: t.Optional[t.Dict[str, t.Any]], threads: t.Optional[int] = None |
| 13 | +) -> DbtOperations: |
12 | 14 | if not isinstance(ctx.obj, functools.partial): |
13 | 15 | raise ValueError(f"Unexpected click context object: {type(ctx.obj)}") |
14 | 16 |
|
15 | | - dbt_operations = ctx.obj(vars=vars) |
| 17 | + dbt_operations = ctx.obj(vars=vars, threads=threads) |
16 | 18 |
|
17 | 19 | if not isinstance(dbt_operations, DbtOperations): |
18 | 20 | raise ValueError(f"Unexpected dbt operations type: {type(dbt_operations)}") |
@@ -128,16 +130,22 @@ def dbt( |
128 | 130 | @click.option( |
129 | 131 | "--empty/--no-empty", default=False, help="If specified, limit input refs and sources" |
130 | 132 | ) |
| 133 | +@click.option( |
| 134 | + "--threads", |
| 135 | + type=int, |
| 136 | + help="Specify number of threads to use while executing models. Overrides settings in profiles.yml.", |
| 137 | +) |
131 | 138 | @vars_option |
132 | 139 | @click.pass_context |
133 | 140 | def run( |
134 | 141 | ctx: click.Context, |
135 | 142 | vars: t.Optional[t.Dict[str, t.Any]], |
| 143 | + threads: t.Optional[int], |
136 | 144 | env: t.Optional[str] = None, |
137 | 145 | **kwargs: t.Any, |
138 | 146 | ) -> None: |
139 | 147 | """Compile SQL and execute against the current target database.""" |
140 | | - _get_dbt_operations(ctx, vars).run(environment=env, **kwargs) |
| 148 | + _get_dbt_operations(ctx, vars, threads).run(environment=env, **kwargs) |
141 | 149 |
|
142 | 150 |
|
143 | 151 | @dbt.command(name="list") |
|
0 commit comments