recon_gen.common.spine.dry_run_renderer
AY.4.b — render captured (sql, params) pairs as static SQL text.
ScenarioContext.compose(dry_run=True) returns [(sql_with_placeholders, params_tuple), …] per AY.4.a. This module walks that list and substitutes each placeholder with the properly-escaped literal value, producing a static SQL script the build_full_seed_sql path can write to disk or pipe to a real DB.
Per-dialect placeholder patterns:
SQLite: ? — substitution in left-to-right order
Postgres: %s — substitution in left-to-right order
Oracle: :1, :2, … — explicit numeric, mapped by index
Literal escaping is type-dispatched:
None → NULL
str → ‘escaped’ (single-quote doubling)
int / float → bare numeric (no scientific notation; AY.4.b matches the OLD _sql_str(money) shape)
bool → 1 / 0 (no dialect uses bool yet but defensive)
BC.14 (2026-05-24) — Oracle TIMESTAMP wrapping now handled shape-detection-side. The renderer detects YYYY-MM-DD HH:MM:SS strings (the spine’s canonical timestamp format) and wraps them with ANSI SQL TIMESTAMP ‘YYYY-MM-DD HH24:MI:SS’ when dialect is Oracle. Oracle accepts the ANSI form unambiguously regardless of NLS_DATE_FORMAT. PG + SQLite still emit bare quoted strings (which both accept). Surfaced as ORA-01843 at stmt #2368 of data apply post-BC.12 (the bug was masked by the earlier BC.12 ORA-32368 wall).
Functions
|
Walk captured (sql, params) pairs + render each as a static SQL statement. |
- recon_gen.common.spine.dry_run_renderer.render_captured_sql(captured, *, dialect, statement_separator=';\\n')[source]
Walk captured (sql, params) pairs + render each as a static SQL statement. Returns the concatenated script with each statement terminated by statement_separator (default ;n).
Use after ScenarioContext.compose(dry_run=True) to feed the output to emit_to_target / write-to-disk / pipe-to-psql.
- Return type:
str- Parameters:
captured (Iterable[tuple[str, tuple[object, ...]]])
dialect (Dialect)
statement_separator (str)