diff --git a/core/dbt/main.py b/core/dbt/main.py index 107ff234b8e..20df0380b36 100644 --- a/core/dbt/main.py +++ b/core/dbt/main.py @@ -380,11 +380,13 @@ def _build_docs_generate_subparser(subparsers, base_subparser): return generate_sub -def _add_selection_arguments(*subparsers): +def _add_selection_arguments(*subparsers, **kwargs): + models_name = kwargs.get('models_name', 'models') for sub in subparsers: sub.add_argument( - '-m', - '--models', + '-{}'.format(models_name[0]), + '--{}'.format(models_name), + dest='models', required=False, nargs='+', help=""" @@ -722,7 +724,8 @@ def parse_args(args): rpc_sub) # --models, --exclude _add_selection_arguments(run_sub, compile_sub, generate_sub, test_sub, - archive_sub, snapshot_sub) + archive_sub) + _add_selection_arguments(snapshot_sub, models_name='select') # --full-refresh _add_table_mutability_arguments(run_sub, compile_sub) diff --git a/test/integration/004_simple_snapshot_test/test_simple_snapshot.py b/test/integration/004_simple_snapshot_test/test_simple_snapshot.py index 3dd3b902bee..a3385627648 100644 --- a/test/integration/004_simple_snapshot_test/test_simple_snapshot.py +++ b/test/integration/004_simple_snapshot_test/test_simple_snapshot.py @@ -151,7 +151,7 @@ def test__postgres_exclude_snapshots(self): @use_profile('postgres') def test__postgres_select_snapshots(self): self.run_sql_file('seed_pg.sql') - results = self.run_dbt(['snapshot', '--models', 'snapshot_castillo']) + results = self.run_dbt(['snapshot', '--select', 'snapshot_castillo']) self.assertEqual(len(results), 1) self.assertTablesEqual('snapshot_castillo', 'snapshot_castillo_expected') self.assertTableDoesNotExist('snapshot_alvarez') @@ -425,7 +425,7 @@ def test__bigquery__snapshot_with_new_field(self): # this should fail because `check="all"` will try to compare the nested field self.run_dbt(['snapshot'], expect_pass=False) - self.run_dbt(["snapshot", '-m', 'snapshot_actual']) + self.run_dbt(["snapshot", '--select', 'snapshot_actual']) # A more thorough test would assert that snapshotted == expected, but BigQuery does not support the # "EXCEPT DISTINCT" operator on nested fields! Instead, just check that schemas are congruent.