Skip to content

Commit

Permalink
[Backport] #3674 (#3718)
Browse files Browse the repository at this point in the history
* Add build RPC method (#3674)

* Add build RPC method

* Add rpc test, some required flags

* Fix flake8

* PR feedback

* Update changelog [skip ci]

* Do not skip CI when rebasing

* Trigger CI so I can merge
  • Loading branch information
jtcohen6 authored and Kyle Wigley committed Sep 17, 2021
1 parent e48beab commit c039808
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Contributors:
- Add `build` RPC method, and a subset of flags for `build` task ([#3595](https://github.com/dbt-labs/dbt/issues/3595), [#3674](https://github.com/dbt-labs/dbt/pull/3674))
- Get more information on partial parsing version mismatches ([#3757](https://github.com/dbt-labs/dbt/issues/3757), [#3758](https://github.com/dbt-labs/dbt/pull/3758))

## dbt 0.21.0b1 (August 03, 2021)

### Breaking changes

- Add full node selection to source freshness command and align selection syntax with other tasks (`dbt source freshness --select source_name` --> `dbt source freshness --select source:souce_name`) and rename `dbt source snapshot-freshness` -> `dbt source freshness`. ([#2987](https://github.com/dbt-labs/dbt/issues/2987), [#3554](https://github.com/dbt-labs/dbt/pull/3554))
Expand All @@ -82,7 +84,6 @@ Contributors:
- Fix type coercion issues when fetching query result sets ([#2984](https://github.com/dbt-labs/dbt/issues/2984), [#3499](https://github.com/dbt-labs/dbt/pull/3499))
- Handle whitespace after a plus sign on the project config ([#3526](https://github.com/dbt-labs/dbt/pull/3526))
- Fix table and view materialization issue when switching from one to the other ([#2161](https://github.com/dbt-labs/dbt/issues/2161)), [#3547](https://github.com/dbt-labs/dbt/pull/3547))
- Fix for RPC requests that raise a RecursionError when serializing Undefined values as JSON ([#3464](https://github.com/dbt-labs/dbt/issues/3464), [#3687](https://github.com/dbt-labs/dbt/pull/3687))

### Under the hood

Expand Down
3 changes: 1 addition & 2 deletions core/dbt/contracts/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ class RPCDocsGenerateParameters(RPCParameters):
@dataclass
class RPCBuildParameters(RPCParameters):
resource_types: Optional[List[str]] = None
threads: Optional[int] = None
models: Union[None, str, List[str]] = None
select: Union[None, str, List[str]] = None
threads: Optional[int] = None
exclude: Union[None, str, List[str]] = None
selector: Optional[str] = None
state: Optional[str] = None
Expand Down
12 changes: 12 additions & 0 deletions test/rpc/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
{% endsnapshot %}
'''

<<<<<<< HEAD

=======
>>>>>>> b67e877c ([Backport] #3674 (#3718))
@pytest.mark.supported('postgres')
def test_rpc_build_threads(
project_root, profiles_root, dbt_profile, unique_schema
Expand Down Expand Up @@ -113,20 +116,29 @@ def test_rpc_build_state(

get_write_manifest(querier, os.path.join(state_dir, 'manifest.json'))

<<<<<<< HEAD
project.models['my_model.sql'] =\
'select * from {{ ref("data" )}} where id = 2'
=======
project.models['my_model.sql'] = 'select * from {{ ref("data" )}} where id = 2'
>>>>>>> b67e877c ([Backport] #3674 (#3718))
project.write_models(project_root, remove=True)
querier.sighup()
assert querier.wait_for_status('ready') is True

results = querier.async_wait_for_result(
<<<<<<< HEAD
querier.build(state='./state', select=['state:modified'])
=======
querier.build(state='./state', models=['state:modified'])
>>>>>>> b67e877c ([Backport] #3674 (#3718))
)
assert len(results['results']) == 3

get_write_manifest(querier, os.path.join(state_dir, 'manifest.json'))

results = querier.async_wait_for_result(
<<<<<<< HEAD
querier.build(state='./state', select=['state:modified']),
)
assert len(results['results']) == 0
Expand Down

0 comments on commit c039808

Please sign in to comment.