Skip to content

Feat/dbt fusion - #1657

Draft
folhesgabriel wants to merge 5 commits into
mainfrom
feat/dbt-fusion
Draft

folhesgabriel wants to merge 5 commits into
mainfrom
feat/dbt-fusion

Conversation

@folhesgabriel

Copy link
Copy Markdown
Collaborator

Template Pull Requests - Pipeline

Nomeação do Pull Request

A nomeação de cada Pull Request (PR) deve seguir o seguinte padrão:

  • O título de cada Pull Request (PR) deve começar com uma das seguintes palavras-chave, entre colchetes. Além disso, marque a palavra-chave que melhor descreve o seu PR atual:
    • [Feature]: Para novas funcionalidades.
    • [Data]: Para subida de novos dados em produção.
    • [Bugfix]: Para correções de bugs.
    • [Refactor]: Para mudanças no código que não alteram a funcionalidade.
    • [Docs]: Para atualizações na documentação.
    • [Test]: Para mudanças relacionadas a testes.
    • [Chore]: Para tarefas menores e de manutenção.
    • [Deactivate]: Para desativar o schedule da Pipeline

  • Exemplos de título:
    • [docs] br_me_caged
    • [Feature] br_cgu_servidores_publicos

Draft:

  • Ao abrir o PR, deverá coloca-lo como draft

Descrição do PR:

  • Explique de maneira clara e concisa o objetivo deste PR. O que foi alterado? Qual o problema que ele resolve?
    • Motivação/Contexto:

Detalhes Técnicos:

  • Detalhe as mudanças mais técnicas, como ajustes na pipeline, scripts ou modelo de dados utilizado.

    • Principais alterações na pipeline/scripts:
    • Mudanças nos dados e no schema:
    • Impacto no desempenho:
  • Se alguma parte do código precisar de alguma atenção a mais, comente na linha sinalizando para os revisores.

Teste e Validações:

  • Relate os testes e validações relacionado aos dados/script:

    • Testado localmente
    • Testado na Cloud

    Caso haja algo relacionado aos testes que vale a pena informar:

Riscos e Mitigações:

  • Identifique os riscos potenciais desta mudança e como mitigar esses Riscos

    • Riscos conhecidos:
    • Planos de rollback:

Dependencias:

  • Liste quaisquer dependências externas, como bibliotecas, outros PRs ou mudanças que precisam ser feitas antes deste merge.
    • Dependências:
    • Nenhuma dependencias adicional

Revisadores:

  • Quando o PR estiver pronto para ser revisado, retire o Draft através do Ready for reviews, marque os revisadores de repositório, envie o PR no nosso discord na aba Correções de PRs, arquiteturas e afins e marque a @equipe_dados:
    • Revisadores recomendados no github:
      • basedosdados/dados

Migração faseada e reversível do engine dbt-core (Python) para o dbt Fusion
(Rust), atrás de um switch de runtime (DBT_ENGINE), com dbt-core mantido como
engine de produção até o adapter BigQuery do Fusion ir a GA.

- dbt_project.yml: require-dbt-version >=1.8.0,<3.0.0 (aceito por ambos engines)
- packages.yml: dbt_utils 1.1.1 -> 1.3.0 (compatível com Fusion)
- Dockerfile: instala binário Fusion (dbtf) coexistindo com o core (dbt)
- cd-staging.yaml: job fusion-checks paralelo (continue-on-error) em PRs test-dev-model
- engine.py (novo): run_dbt_command() despacha por DBT_ENGINE (core=dbtRunner, fusion=subprocess dbtf)
- flows.py / tasks.py: passam a usar run_dbt_command()
- CONTRIBUTING.md: seção Fusion (instalação, dois engines, ELv2, adapter beta)
- ONBOARDING.md: handoff da migração + plano da Fase 0 (correções para dbtf parse)
…ING.md

Promove o subconjunto operacional dos docs internos (gitignored
docs/dbt-fusion-*.md) para o CONTRIBUTING.md, que é a doc versionada:

- gotcha do packages-install-path (/app/dbt_packages) por engine
- seção 'Selecionando o engine (DBT_ENGINE)': DBT_ENGINE/DBT_FUSION_BIN/
  DBT_FUSION_VERSION, onde a chave mora (engine.py), setup no worker Prefect,
  e rollback instantâneo
- checklist expandido de macros/testes sensíveis ao engine + comandos
  dbtf deps/parse/compile
- nota sobre o formato 'arguments:' de testes exigido pelo Fusion (exemplos
  mantidos no formato atual: dbt-core 1.8.8 não aceita 'arguments:')
…nsform

Fusion requires generic-test args nested under `arguments:`, which dbt-core
1.8.x (the production engine) rejects. Supporting both on the same files would
need dbt-core >=1.10, which requires protobuf>=5 — incompatible with the
project's pinned Google libs (google-analytics-data, google-api-core,
googleapis-common-protos all need protobuf<5). So the repo keeps the old
test-arg format (core-compatible) and the `arguments:` conversion runs
ephemerally at build time for Fusion only (CI fusion-checks) via
`uvx dbt-autofix deprecations` — it is not committed.

Real bug fixes below are valid on both engines (old format), committed:

Name fixes (dbt1501):
- set_datalake_project typo (br_bd_diretorios_data_tempo__trimestre)
- custom_dictionaries -> custom_dictionary_coverage (br_ibge_censo_2022)
- english_tables_dictionary_coverage -> custom_dictionary_coverage_eng x10
  (world_iea_timss)

Latent bugs, behavior restored (dbt1060):
- test: -> tests: (br_inep_ideb x4) — dead accepted_values now run
- column-level where -> per-test config (br_ms_cnes x31, br_me_cnpj x5) —
  restores the incremental __most_recent_*__ filter that dbt-core silently
  dropped
- materialization -> materialized (br_denatran_frota x2)
- tag -> tags (br_ibge_censo_2022)

Also: br_ms_pns leading-quote descriptions cleaned so build-time autofix can
parse; fusion-checks CI runs ephemeral dbt-autofix and sets
DBT_PACKAGES_INSTALL_PATH; CONTRIBUTING.md and ONBOARDING.md document the
build-time strategy; .gitignore adds package-lock.yml (dbtf deps artifact).

Validated: `uv run dbt parse` (core 1.8.8) clean on committed files; `dbtf
parse` = 0 errors after the ephemeral transform (only warnings dbt1087/1089/
1041 remain).

Behavior-change caveats to validate before any Fusion run/test:
- br_inep_ideb accepted_values (ensino/anos_escolares) now execute
- br_ms_cnes/br_me_cnpj not_null tests now scoped to the most-recent partition
- br_denatran_frota now materializes as incremental/table as intended
…ection

- build-docker-prefect3{,-dev}.yaml: thread DBT_FUSION_VERSION build-arg
  (from vars.DBT_FUSION_VERSION) so the worker image installs dbtf; the
  existing work-pool image PATCH step then makes the pool run Fusion.
- deploy_flows.py: new repeatable --env KEY=VALUE flag, merged into each
  flow's job_variables[env] without clobbering other keys.
- cd-prefect3-staging.yaml: deploy-flow-fusion label injects DBT_ENGINE=fusion.
- Principal dbtf commands cheat-sheet (deps/parse/compile/run/test/build/ls).
- DBT_FUSION_VERSION CD source note (vars.DBT_FUSION_VERSION).
- Fix stale cd-staging.yaml link -> pr-checks.yaml.

(Execution-test report lives at docs/fusion-execution-test.md, untracked:
docs/ is gitignored.)
@folhesgabriel
folhesgabriel marked this pull request as draft July 14, 2026 14:13
Comment thread Dockerfile
# Defina DBT_FUSION_VERSION para fixar a versão; vazio instala a mais recente.
ARG DBT_FUSION_VERSION=""
ENV PATH="/usr/local/bin:/root/.local/bin:${PATH}"
RUN curl -fsSL https://public.cdn.getdbt.com/fs/install/install.sh \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [hadolint] <SC2046> reported by reviewdog 🐶
Quote this to prevent word splitting.

Comment thread Dockerfile
# Defina DBT_FUSION_VERSION para fixar a versão; vazio instala a mais recente.
ARG DBT_FUSION_VERSION=""
ENV PATH="/usr/local/bin:/root/.local/bin:${PATH}"
RUN curl -fsSL https://public.cdn.getdbt.com/fs/install/install.sh \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [hadolint] <DL4006> reported by reviewdog 🐶
Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dbt-fusion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@folhesgabriel folhesgabriel linked an issue Jul 14, 2026 that may be closed by this pull request
28 tasks
@mergify

mergify Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@folhesgabriel esse pull request tem conflitos 😩

@mergify mergify Bot added the conflict [PR] Conflito de merge a resolver label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict [PR] Conflito de merge a resolver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chore] migração de dbt-core para dbt Fusion

1 participant