|
20 | 20 | import typer
|
21 | 21 | from snowflake.cli._plugins.dbt.constants import DBT_COMMANDS
|
22 | 22 | from snowflake.cli._plugins.dbt.manager import DBTManager
|
| 23 | +from snowflake.cli._plugins.object.command_aliases import add_object_command_aliases |
| 24 | +from snowflake.cli._plugins.object.commands import scope_option |
23 | 25 | from snowflake.cli.api.commands.decorators import global_options_with_connection
|
24 |
| -from snowflake.cli.api.commands.flags import identifier_argument |
| 26 | +from snowflake.cli.api.commands.flags import identifier_argument, like_option |
25 | 27 | from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
|
| 28 | +from snowflake.cli.api.constants import ObjectType |
26 | 29 | from snowflake.cli.api.feature_flags import FeatureFlag
|
27 | 30 | from snowflake.cli.api.identifiers import FQN
|
28 | 31 | from snowflake.cli.api.output.types import CommandResult, MessageResult, QueryResult
|
|
39 | 42 | DBTNameArgument = identifier_argument(sf_object="DBT Project", example="my_pipeline")
|
40 | 43 |
|
41 | 44 |
|
42 |
| -@app.command( |
43 |
| - "list", |
44 |
| - requires_connection=True, |
| 45 | +add_object_command_aliases( |
| 46 | + app=app, |
| 47 | + object_type=ObjectType.DBT_PROJECT, |
| 48 | + name_argument=DBTNameArgument, |
| 49 | + like_option=like_option( |
| 50 | + help_example='`list --like "my%"` lists all dbt projects that begin with “my”' |
| 51 | + ), |
| 52 | + scope_option=scope_option(help_example="`list --in database my_db`"), |
| 53 | + ommit_commands=["drop", "create", "describe"], |
45 | 54 | )
|
46 |
| -def list_dbts( |
47 |
| - **options, |
48 |
| -) -> CommandResult: |
49 |
| - """ |
50 |
| - List all dbt on Snowflake projects. |
51 |
| - """ |
52 |
| - return QueryResult(DBTManager().list()) |
53 | 55 |
|
54 | 56 |
|
55 | 57 | @app.command(
|
|
0 commit comments