dbt-labs / dbt-event-logging

a dbt package to make auditing dbt runs easy.

Home Page:https://hub.getdbt.com/dbt-labs/logging/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to view stg_dbt_audit_log

tyblevins opened this issue · comments

Issue Overview

I am currently unable to view the three convenience models in the meta schema because the stg_dbt_audit_log model has what I believe to be an incorrect reference to dbt_audit_log.

https://github.com/fishtown-analytics/dbt-event-logging/blob/master/models/stg_dbt_audit_log.sql#L3

select * from {{this.schema}}.dbt_audit_log gets compiled to select * from meta.dbt_audit_log. However, the dbt_audit_log model actually has the schema [target.schema]_meta and so the query fails.

Proposed Solution

I think we can change the line to read select * from {{ logging.get_audit_relation() }} or select * from {{ logging.get_audit_schema() }}.dbt_audit_log

I'm sure I'm overlooking something so please know what you think.

@tyblevins thanks for the report. I think this package is generally in need of an overhaul -- it's on my list! See this issue for more info: #7

The background is that we released this package before the desired functionality was fully built out in dbt. As a result, the package is pretty brittle. The good news is that we can more or less rebuild all of the custom schema logic now with some new dbt functionality from our 0.12.2 release. I'd be way more interested in doing that than continuing to pile on this shaky foundation!

So, thanks for the report, and will keep you posted here as we're able to upgrade the logic in this package.

@drewbanin Gotcha -- yeah I saw that issue was pretty related and debated commenting there instead of creating a new issue.

Thanks for adding some color to this for me! Your logic here makes sense. I'll keep an eye out for updates and please let me know if I can lend a hand.

Closing in favor of #14.