scd2migration

package
v0.11.691 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package scd2migration is a TEMPORARY, self-contained upgrade shim.

⚠️ TEMPORARY MIGRATION — SAFE TO DELETE AFTER IT EXPIRES ⚠️

Created:  2026-07-08
Expires:  2026-10-08  (~3 months later)
Purpose:  SCD2 tables created before _valid_from/_valid_until became
          timezone-aware still carry the legacy column types. This shim
          converts them on the incremental path, reading the stored values
          as UTC. It is a no-op once the columns are correct, so it is safe
          to run on every incremental.
Affects:  Postgres, Snowflake, MySQL and Oracle (this package). DuckDB and
          Athena are NOT affected — their incremental rebuilds the table and
          converts legacy values automatically.
Removal:  On or after the expiry date, once existing deployments have run at
          least once on the timezone-aware release, delete this package and
          the call sites in pkg/{postgres,snowflake,mysql,oracle}/operator.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MySQL

func MySQL(ctx context.Context, db Querier, assetName string) error

MySQL converts the legacy VARCHAR _valid_until (from the old string sentinel) and any non-DATETIME _valid_from to DATETIME. MySQL SCD2 columns are naive (UTC by convention), so no timezone conversion is applied.

func Oracle

func Oracle(ctx context.Context, db Querier, assetName string) error

Oracle converts naive bruin_valid_from/bruin_valid_until columns to TIMESTAMP(6) WITH TIME ZONE, reading the naive values in the session timezone and normalizing the result to a UTC (+00) offset.

func Postgres

func Postgres(ctx context.Context, db Querier, assetName string) error

Postgres converts naive _valid_from/_valid_until columns to TIMESTAMPTZ, reading the stored values as UTC.

func Snowflake

func Snowflake(ctx context.Context, db Querier, assetName string) error

Snowflake converts TIMESTAMP_NTZ (and non-target TIMESTAMP_LTZ) columns to TIMESTAMP_TZ, reading the stored values as UTC.

Types

type Querier

type Querier interface {
	Select(ctx context.Context, q *query.Query) ([][]interface{}, error)
	RunQueryWithoutResult(ctx context.Context, q *query.Query) error
}

Querier is satisfied by every SQL engine's DB client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL