Closed emmyoop closed 4 months ago
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.
Attention: Patch coverage is 21.79487%
with 61 lines
in your changes missing coverage. Please review.
Project coverage is 63.03%. Comparing base (
e30f65f
) to head (aef3c30
).
Files | Patch % | Lines |
---|---|---|
dbt_common/record.py | 21.79% | 61 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
resolves #144
Description
Adds a
DIFF
mode to record.Expected format:
DBT_RECORDER_MODE=DIFF DBT_RECORDER_FILE_PATH=recording_old.json dbt run --no-partial-parse
Diff will record using the same types as the input file and then diff the two files. It ouputs a
diff.json
with the results. Current state is just json that's reasonably readable but not what we'd necesary want to shwo as output. But we could parse it out later.example `diff.json`
``` { "GetEnvRecord": {}, "LoadFileRecord": { "values_changed": { "root[13]['result']['contents']": { "new_value": "select 1 as some new id", "old_value": "select 1 as id" }, "root[24]['result']['contents']": { "new_value": "-- Edit the comments: Use the `ref` function to select from other models\n\nselect *\nfrom {{ ref('my_first_dbt_model') }}\nwhere id = 1", "old_value": "-- Use the `ref` function to select from other models\n\nselect *\nfrom {{ ref('my_first_dbt_model') }}\nwhere id = 1", "new_path": "root[23]['result']['contents']", "diff": "--- \n+++ \n@@ -1,4 +1,4 @@\n--- Use the `ref` function to select from other models\n+-- Edit the comments: Use the `ref` function to select from other models\n \n select *\n from {{ ref('my_first_dbt_model') }}" } }, "iterable_item_removed": { "root[23]": { "params": { "path": "/Users/emily/projects/basic-dbt/models/example/my_first_dbt_model.sql", "strip": true }, "result": { "contents": "/*\n Welcome to your first dbt model!\n Did you know that you can also configure models directly within SQL files?\n This will override configurations stated in dbt_project.yml\n\n Try changing \"table\" to \"view\" below\n*/\n\n{{ config(materialized='table') }}\n\nwith source_data as (\n\n select 1 as id\n union all\n select null as id\n\n)\n\nselect *\nfrom source_data\n\n/*\n Uncomment the line below to remove records with null `id` values\n*/\n\n-- where id is not null" } } } }, "FindMatchingRecord": { "iterable_item_removed": { "root[0]": { "params": { "root_path": "/Users/emily/projects/basic-dbt", "relative_paths_to_search": [ "macros" ], "file_pattern": "[!.#~]*.sql" }, "result": { "matches": [ { "searched_path": "macros", "absolute_path": "/Users/emily/projects/basic-dbt/macros/lots_of_macros.sql", "relative_path": "lots_of_macros.sql", "modification_time": 1717083600.9987388 } ] } } } }, "WriteFileRecord": {}, "QueryRecord": {} } ```
Checklist
changie new
to create a changelog entry