Skip to content

Commit

Permalink
Change update-relation-profile.sh now uses awk instead of sed (#73)
Browse files Browse the repository at this point in the history
Co-authored-by: Simo Tumelius <[email protected]>
  • Loading branch information
stumelius and datamie-simo authored Jun 5, 2023
1 parent 227a076 commit 2ea0ede
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions update-relation-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ fi

RUN_OPERATION_OUTPUT=$(dbt run-operation print_profile_docs --args '{"schema": "'$schema'", "relation_name": "'$relation_name'", "docs_name": "dbt_profiler_results__'$schema'_'$relation_name'"}')

# The hacky sed gets rid of everything in the output that comes before {& docs (e.g., Running with dbt=0.20.0 )
PROFILE=$(echo "$RUN_OPERATION_OUTPUT" | sed -n '/{% docs/,$p')
# Extract docs block from stdout
PROFILE=$(echo "$RUN_OPERATION_OUTPUT" | awk '/{%.docs.*%}$/{flag=1} flag; /{%.enddocs.%}/{flag=0}')

output_dir=docs/dbt_profiler/$schema
output_path=$output_dir/$relation_name.md
Expand Down

0 comments on commit 2ea0ede

Please sign in to comment.