Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change dbt list command to always return 0 as exit code #2892

Merged
merged 2 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fix Redshift adapter `get_columns_in_relation` macro to push schema filter down to the `svv_external_columns` view ([#2855](https://github.com/fishtown-analytics/dbt/issues/2854))
- Add `unixodbc-dev` package to testing docker image ([#2859](https://github.com/fishtown-analytics/dbt/pull/2859))
- Increased the supported relation name length in postgres from 29 to 51 ([#2850](https://github.com/fishtown-analytics/dbt/pull/2850))
- dbt list command always return 0 as exit code ([#2886](https://github.com/fishtown-analytics/dbt/issues/2886), [#2892](https://github.com/fishtown-analytics/dbt/issues/2892))

### Under the hood
- Bump hologram version to 0.0.11. Add scripts/dtr.py ([#2888](https://github.com/fishtown-analytics/dbt/issues/2840),[#2889](https://github.com/fishtown-analytics/dbt/pull/2889))
Expand All @@ -22,6 +23,7 @@ Contributors:
- [@brangisom](https://github.com/brangisom) [#2855](https://github.com/fishtown-analytics/dbt/pull/2855)
- [@elexisvenator](https://github.com/elexisvenator) ([#2850](https://github.com/fishtown-analytics/dbt/pull/2850))
- [@franloza](https://github.com/franloza) ([#2837](https://github.com/fishtown-analytics/dbt/pull/2837))
- [@rsella](https://github.com/rsella) ([#2892](https://github.com/fishtown-analytics/dbt/issues/2892))

## dbt 0.19.0b1 (October 21, 2020)

Expand Down
3 changes: 2 additions & 1 deletion core/dbt/task/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,5 @@ def get_node_selector(self):
)

def interpret_results(self, results):
return bool(results)
# list command should always return 0 as exit code
return True
4 changes: 2 additions & 2 deletions test/integration/047_dbt_ls_test/test_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def expect_select(self):
results = self.run_dbt_ls(['--resource-type', 'test', '--select', 'outer'])
self.assertEqual(set(results), {'test.schema_test.not_null_outer_id', 'test.schema_test.unique_outer_id'})

self.run_dbt_ls(['--resource-type', 'test', '--select', 'inner'], expect_pass=False)
self.run_dbt_ls(['--resource-type', 'test', '--select', 'inner'], expect_pass=True)

results = self.run_dbt_ls(['--resource-type', 'test', '--select', '+inner'])
self.assertEqual(set(results), {'test.schema_test.not_null_outer_id', 'test.schema_test.unique_outer_id'})
Expand All @@ -450,7 +450,7 @@ def expect_select(self):
results = self.run_dbt_ls(['--select', 'config.incremental_strategy:delete+insert'])
self.assertEqual(set(results), {'test.incremental'})

self.run_dbt_ls(['--select', 'config.incremental_strategy:insert_overwrite'], expect_pass=False)
self.run_dbt_ls(['--select', 'config.incremental_strategy:insert_overwrite'], expect_pass=True)


@use_profile('postgres')
Expand Down
8 changes: 4 additions & 4 deletions test/integration/062_defer_state_test/test_modified_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def setUp(self):

@use_profile('postgres')
def test_postgres_changed_seed_contents_state(self):
results = self.run_dbt(['ls', '--resource-type', 'seed', '--select', 'state:modified', '--state', './state'], strict=False, expect_pass=False)
results = self.run_dbt(['ls', '--resource-type', 'seed', '--select', 'state:modified', '--state', './state'], strict=False, expect_pass=True)
assert len(results) == 0
with open('data/seed.csv') as fp:
fp.readline()
Expand Down Expand Up @@ -106,12 +106,12 @@ def test_postgres_changed_seed_contents_state(self):
with open('data/seed.csv', 'a') as fp:
fp.write(f'{random},test{newline}')

results = self.run_dbt(['ls', '--resource-type', 'seed', '--select', 'state:modified', '--state', './state'], strict=False, expect_pass=False)
results = self.run_dbt(['ls', '--resource-type', 'seed', '--select', 'state:modified', '--state', './state'], strict=False, expect_pass=True)
assert len(results) == 0

@use_profile('postgres')
def test_postgres_changed_seed_config(self):
results = self.run_dbt(['ls', '--resource-type', 'seed', '--select', 'state:modified', '--state', './state'], strict=False, expect_pass=False)
results = self.run_dbt(['ls', '--resource-type', 'seed', '--select', 'state:modified', '--state', './state'], strict=False, expect_pass=True)
assert len(results) == 0

self.use_default_project({'seeds': {'test': {'quote_columns': False}}})
Expand All @@ -123,7 +123,7 @@ def test_postgres_changed_seed_config(self):

@use_profile('postgres')
def test_postgres_unrendered_config_same(self):
results = self.run_dbt(['ls', '--resource-type', 'model', '--select', 'state:modified', '--state', './state'], strict=False, expect_pass=False)
results = self.run_dbt(['ls', '--resource-type', 'model', '--select', 'state:modified', '--state', './state'], strict=False, expect_pass=True)
assert len(results) == 0

# although this is the default value, dbt will recognize it as a change
Expand Down