Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.
This repository was 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

@tarnpreetb123

Description

@tarnpreetb123
**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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions