dbt-labs / dbt-adapters

Apache License 2.0
25 stars 35 forks source link

Users should always call `adapter.drop_relation` instead of calling `{{ drop_relation() }}` directly #221

Open jtcohen6 opened 4 months ago

jtcohen6 commented 4 months ago

Adapter maintainers and users should always call either:

Why? Calling {{ drop_relation() }} directly does not update the cache!! That happens within the adapter drop_relation method here:

https://github.com/dbt-labs/dbt-adapters/blob/a2292c8ec76e4c9f03869ad95817a2ad82dfb34b/dbt/adapters/sql/impl.py#L140-L145

Even though this method ultimately shells out to a macro called {{ drop_relation() }}:

https://github.com/dbt-labs/dbt-adapters/blob/a2292c8ec76e4c9f03869ad95817a2ad82dfb34b/dbt/include/global_project/macros/relations/drop.sql#L26-L34

Proposals