Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Post-hooks do not work for Python models with dbt-fal, postgres adapter #913

Open
tarnpreetb123 opened this issue Dec 22, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@tarnpreetb123
Copy link

**Describe the bug**
-- models/input/model_a.sql
select 1 as pk
# models/base/model_b.py
def model(dbt, session):
    df = dbt.ref("model_a")
    return df
---dbt_project.yml
models:
    input:
      +materialized: table
      schema: input
    base:
      +materialized: table
      schema: base
      +post-hook:
           sql: " {{ alter_pk() }} "
           transaction: false
---alter_pk.sql
{% macro alter_pk() %}
    ALTER TABLE {{this}}
    ADD PRIMARY KEY(pk)
{% endmacro %}

Using a python model with the postgres adapter, the post_hook is ignored. Calling it from the model, or the dbt_project.yml results in the same behavior of it being ignored.

Your environment

Using dbt-postgres: 1.5.5
and dbt-fal: 1.5.9

- OS: Windows 10
- Python: 3.10.7
- dbt:1.5.5
- fal: 1.5.9

Expected behavior
I expect the post-hook to run the sql command like it would for a sql model.
Actual behavior

Additional context
dbt-labs/dbt-core#9310

@tarnpreetb123 tarnpreetb123 added the bug Something isn't working label Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant