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

Feature: contexts cleanup #2085

Merged
merged 3 commits into from
Feb 7, 2020
Merged

Commits on Feb 6, 2020

  1. dbt Contexts

    Rewrite/reorganize contexts
     - now they are objects that have a to_dict()
     - special decorators on properties/methods to indicate membership
     - reorganize contexts/ to remove many many import cycles
    
    Context behavior changes:
     - 'dbt_version' is alwways available
     - 'target' is available as long as the profile has been parsed
     - 'project_name' is available in: query headers, hooks, models, and macro execution
    
    Profiles/projects now render at load time
     - reading a profile or project file requires a ConfigRenderer
     - projects get an extra-fiddly special load for use during initial parsing
        - it returns the profile name and a function that, given a renderer, can return the rest of the Project
        - idea is: use the profile name to load the Profile, use that to build a ConfigRenderer that has a TargetContext, render the project with that
     - profiles.yml is rendered with the 'base' context
     - dbt_project.yml/schema.yml/packages.yml are rendered with the 'target' context: 'base' context + 'target'
     - docs are rendered with the docs context: 'target' context + the 'doc' function
     - query headers are rendered with the query header context: 'target' context + macros + 'project_name'
     - executed macros/models should have the same context as previously (query headers + adapter/model/etc related functions)
    
    Moved actual ref/source searching into the manifest
    Moved the rest of the parse utils into parser/manifest.py
    Made the ref/source resolvers defined in the provider context a bit more sane/well-defined
    Picked consistent-but-not-great names for all the various context generation functions
    Moved write_node into ParsedNode
    Jacob Beck committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    b8febdd View commit details
    Browse the repository at this point in the history
  2. add some tests

    Make slight tweaks to project initialization to support tests
    Jacob Beck committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    ee710e3 View commit details
    Browse the repository at this point in the history
  3. PR feedback

    Fix comments
    Implement a TODO around duplicate macro names
     - added unit tests for it
    Implement a TODO around ref resolution
    Jacob Beck committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    2e5fdbf View commit details
    Browse the repository at this point in the history