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

Vars invalidation (#2265) #2363

Merged
merged 4 commits into from
Apr 28, 2020
Merged

Conversation

beckjake
Copy link
Contributor

@beckjake beckjake commented Apr 27, 2020

resolves #2265

Description

On RPC calls, if the server detects that the final CLI vars calculated from --vars are different from the server's CLI --vars, rebuild the manifest.

This will make those calls slower, because they have to build a manifest (and the partial parsing cache will be invalidated!).

I also moved the vars calculation from set_config (which happens in the main dispatching process) into handle_request (which happens in the RPC process). That fixed an issue where future calls had the wrong vars once you made a call using --vars (ugly!)

I also split up the RPC tests, that file was getting crowded. That accounts for the vast majority of this change, I've noted the only new/changed test.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot cla-bot bot added the cla:yes label Apr 27, 2020
assert results['results'][0]['node']['compiled_sql'] == 'select 100 as id'


def test_rpc_run_vars_compiled(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only new test in this PR.

@beckjake beckjake requested a review from drewbanin April 27, 2020 17:12
Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good to me! I'm not so worried about a performance impact here - this should only affect cli_args method calls which don't need to be incredibly snappy (as compared to something like compile_sql or run_sql, for instance).

🚢 🚢 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command line vars are parsed inconsistently in the dbt server
2 participants