Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:173TECH Sayn Dev Prod Name Resolution

From Leeroopedia
Knowledge Sources
Domains DevOps, Data_Engineering
Last Updated 2026-10-17 00:00 GMT

Overview

Technique for resolving database object names differently in development and production environments through prefix, suffix, and override rules, with support for selectively using production objects during development.

Description

Dev/prod name resolution allows the same SAYN project to run against different database objects in development vs production without modifying SQL files. This is achieved through stringify rules that transform object names:

  • Prefix: Prepend a string (e.g., dev_ for dev schema prefix)
  • Suffix: Append a string
  • Override: Full Jinja template replacement (e.g., dev_{table})

Additional mechanisms:

  • from_prod: Glob patterns specifying which source tables should use production naming even in dev
  • upstream_prod: CLI flag (-u) that makes all sources not produced by executed tasks use production naming
  • Two-stringify system: Project-level defaults (prod) and profile-level overrides (dev)

Usage

Use this principle when a data platform must support parallel development and production environments sharing the same codebase. It is the right choice when developers need to test against production data sources while writing to development tables.

Theoretical Basis

The name resolution algorithm:

  1. Parse: Object string (e.g., "schema.table") is parsed into database, schema, table components
  2. Check from_prod: Determine if the object should use production naming
    • Match against from_prod glob patterns
    • Check explicit sources_from_prod set (from upstream_prod)
  3. Apply stringify: Use prod_stringify or dev_stringify based on the is_prod flag

Stringify template construction:

  • Default: {table} (no modification)
  • With prefix: prefix_table
  • With suffix: table_suffix
  • With override: Jinja template (e.g., dev_{table})

upstream_prod logic:

Failed to parse (syntax error): {\displaystyle \text{sources\_from\_prod} = \text{exec\_sources} \setminus \text{exec\_outputs} }

Sources not produced by any executed task use production naming.

Practical Guide

In project.yaml (production defaults):

# No prefix/suffix = production uses bare names
table_prefix:
table_suffix:

In settings.yaml (dev profile):

profiles:
  dev:
    schema_prefix: dev
    from_prod:
      - "raw.*"        # Use production raw tables
      - "external.*"   # Use production external tables
  prod:
    # No overrides = use production defaults

CLI usage:

# Use dev profile (schema_prefix: dev)
sayn run -p dev

# Use upstream_prod: sources not produced by executed tasks use prod names
sayn run -p dev -u

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment