Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
iknox-fa committed May 27, 2021
1 parent 90edc38 commit e68fd6e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/dbt/contracts/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class RPCListParameters(RPCParameters):
resource_types: Optional[List[str]] = None
models: Union[None, str, List[str]] = None
exclude: Union[None, str, List[str]] = None
select: Optional[List[str]] = None
select: Union[None, str, List[str]] = None
selector: Optional[str] = None
output: Optional[str] = 'json'

Expand Down
12 changes: 12 additions & 0 deletions core/dbt/task/rpc/project_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
RPCSourceFreshnessParameters,
RPCListParameters,
)
from dbt.exceptions import RuntimeException
from dbt.rpc.method import (
Parameters, RemoteManifestMethod
)
Expand Down Expand Up @@ -278,6 +279,17 @@ def set_args(self, params: RPCListParameters) -> None:
self.args.selector_name = params.selector
self.args.select = self._listify(params.select)

if self.args.models:
if self.args.select:
raise RuntimeException(
'"models" and "select" are mutually exclusive arguments'
)
if self.args.resource_types:
raise RuntimeException(
'"models" and "resource_type" are mutually exclusive '
'arguments'
)

@staticmethod
def output_results(results):
return RemoteListResults(
Expand Down
25 changes: 13 additions & 12 deletions test/integration/047_dbt_ls_test/test_ls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from test.integration.base import DBTIntegrationTest, use_profile
import os
from dbt.logger import log_manager
from test.integration.base import normalize

import json

Expand Down Expand Up @@ -95,7 +96,7 @@ def expect_snapshot_output(self):
'check_cols': None,
},
'unique_id': 'snapshot.test.my_snapshot',
'original_file_path': 'snapshots/snapshot.sql',
'original_file_path': normalize('snapshots/snapshot.sql'),
'alias': 'my_snapshot',
'resource_type': 'snapshot',
},
Expand Down Expand Up @@ -128,7 +129,7 @@ def expect_analyses_output(self):
'alias': None,
},
'unique_id': 'analysis.test.a',
'original_file_path': 'analyses/a.sql',
'original_file_path': normalize('analyses/a.sql'),
'alias': 'a',
'resource_type': 'analysis',
},
Expand Down Expand Up @@ -161,7 +162,7 @@ def expect_model_output(self):
'schema': None,
'alias': None,
},
'original_file_path': 'models/ephemeral.sql',
'original_file_path': normalize('models/ephemeral.sql'),
'unique_id': 'model.test.ephemeral',
'alias': 'ephemeral',
'resource_type': 'model',
Expand All @@ -187,7 +188,7 @@ def expect_model_output(self):
'schema': None,
'alias': None,
},
'original_file_path': 'models/incremental.sql',
'original_file_path': normalize('models/incremental.sql'),
'unique_id': 'model.test.incremental',
'alias': 'incremental',
'resource_type': 'model',
Expand All @@ -212,7 +213,7 @@ def expect_model_output(self):
'schema': None,
'alias': None,
},
'original_file_path': 'models/sub/inner.sql',
'original_file_path': normalize('models/sub/inner.sql'),
'unique_id': 'model.test.inner',
'alias': 'inner',
'resource_type': 'model',
Expand All @@ -237,7 +238,7 @@ def expect_model_output(self):
'schema': None,
'alias': None,
},
'original_file_path': 'models/outer.sql',
'original_file_path': normalize('models/outer.sql'),
'unique_id': 'model.test.outer',
'alias': 'outer',
'resource_type': 'model',
Expand Down Expand Up @@ -274,7 +275,7 @@ def expect_model_ephemeral_output(self):
'alias': None,
},
'unique_id': 'model.test.ephemeral',
'original_file_path': 'models/ephemeral.sql',
'original_file_path': normalize('models/ephemeral.sql'),
'alias': 'outer',
'resource_type': 'model',
},
Expand All @@ -292,7 +293,7 @@ def expect_source_output(self):
'enabled': True,
},
'unique_id': 'source.test.my_source.my_table',
'original_file_path': 'models/schema.yml',
'original_file_path': normalize('models/schema.yml'),
'package_name': 'test',
'name': 'my_table',
'source_name': 'my_source',
Expand Down Expand Up @@ -331,7 +332,7 @@ def expect_seed_output(self):
'alias': None,
},
'unique_id': 'seed.test.seed',
'original_file_path': 'data/seed.csv',
'original_file_path': normalize('data/seed.csv'),
'alias': 'seed',
'resource_type': 'seed',
},
Expand Down Expand Up @@ -366,7 +367,7 @@ def expect_test_output(self):
'alias': None,
},
'unique_id': 'test.test.not_null_outer_id.8f1c176a93',
'original_file_path': 'models/schema.yml',
'original_file_path': normalize('models/schema.yml'),
'alias': 'not_null_outer_id',
'resource_type': 'test',
},
Expand All @@ -392,7 +393,7 @@ def expect_test_output(self):
'alias': None,
},
'unique_id': 'test.test.t',
'original_file_path': 'tests/t.sql',
'original_file_path': normalize('tests/t.sql'),
'alias': 't',
'resource_type': 'test',
},
Expand All @@ -418,7 +419,7 @@ def expect_test_output(self):
'alias': None,
},
'unique_id': 'test.test.unique_outer_id.a653b29b17',
'original_file_path': 'models/schema.yml',
'original_file_path': normalize('models/schema.yml'),
'alias': 'unique_outer_id',
'resource_type': 'test',
},
Expand Down

0 comments on commit e68fd6e

Please sign in to comment.