Skip to content

chore(infra): archive historical marts to marts_archive (D112) - #84

Merged
GMartin-Data merged 1 commit into
mainfrom
chore/archive-historical-marts
May 23, 2026
Merged

GMartin-Data merged 1 commit into
mainfrom
chore/archive-historical-marts

Conversation

@GMartin-Data

Copy link
Copy Markdown
Owner

Contexte

Suite à la validation prod du fix dbt no-op (D111, PR #83), l'inspection
de marts.* a révélé deux tables artefacts du périmètre antérieur à
D94 : fct_offres_enrichies (10269 rows) et fct_contexte_territorial
(8115 rows). Plus pilotées par dbt depuis la refonte en mart unifié
fct_offres. Conservation en l'état → risque de confusion sémantique
(branchement dashboard sur la mauvaise table = mode de défaillance
silencieux refusé par D72/D111 ailleurs dans le système).

Décision (D112)

Voie C2 retenue après arbitrage A/B/C2/D (cf. D112 dans notes-projet.md
pour la justification complète) : migration vers un dataset
marts_archive dédié, pour restaurer l'invariant fort
« marts.* = ce que dbt produit aujourd'hui, point ».

Changements

  • infra/main.tf : ajout "marts_archive" à la liste dataset_ids
    du module bigquery/.

Note importante sur la non-reproductibilité

Le contenu de marts_archive (les 2 tables migrées) n'est pas pilotable
en Terraform — ce sont des données historiques figées, pas de l'infra.
Sur une infra GCP fraîche, terraform apply créera un dataset
marts_archive vide, ce qui est conforme à la doctrine D5 (datasets
gérés en IaC, contenu géré par dbt ou hors-IaC).

Validation

Gestes manuels exécutés en série, traçabilité ci-dessous.

1. Terraform plan + apply

Plan: 1 to add, 0 to change, 0 to destroy.
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
bigquery_dataset_ids = {
  "intermediate" = "intermediate"
  "marts" = "marts"
  "marts_archive" = "marts_archive"
  "raw" = "raw"
  "staging" = "staging"
}

2. Copie des tables (CREATE TABLE AS SELECT)

Created datatalent-glaq-2.marts_archive.fct_offres_enrichies
Created datatalent-glaq-2.marts_archive.fct_contexte_territorial

3. Vérification intégrité row_count

Table Source Archive Match
fct_offres_enrichies 10269 10269 ✅
fct_contexte_territorial 8115 8115 ✅

4. Drop des sources + état final

```
$ bq ls marts
tableId → fct_offres (seule table, partitioning + clustering préservés)

$ bq ls marts_archive
tableId → fct_contexte_territorial, fct_offres_enrichies
```

5. terraform plan zéro diff post-changements

No changes. Your infrastructure matches the configuration.

Décisions liées

  • D112 — décision tracée (créée dans cette PR, dans notes-projet.md
    hors repo).
  • D94 — mart unifié fct_offres qui a refondu les marts antérieurs
    (origine de l'orphelinat).
  • D5 — structure 4 datasets BigQuery : D112 introduit un 5e dataset
    marts_archive qui dérive doctrinalement. À acter au prochain refresh
    de D5.

Refs : D5, D94, D112.

Add marts_archive dataset to the bigquery module. Move
fct_offres_enrichies and fct_contexte_territorial out of marts via
CREATE TABLE AS SELECT + DROP, restoring the invariant that marts.*
contains only dbt-produced tables.
@GMartin-Data
GMartin-Data merged commit bf796e7 into main May 23, 2026
6 checks passed
@GMartin-Data
GMartin-Data deleted the chore/archive-historical-marts branch May 23, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant