recon_gen.common.datasource

Shared QuickSight DataSource builder (M.4.4).

Migrated from apps/payment_recon/datasets.py when the PR app deleted — build_datasource is app-agnostic infrastructure that the harness, the demo CLI, and any future apps all need to construct a DataSource model from a Postgres URL.

Lives under common/ because it has no PR-specific dependencies and all callers (harness’s per-test datasource, recon-gen demo apply, manual deploy scripts) consume it equally.

Functions

build_datasource(cfg)

Build a QuickSight DataSource from cfg.demo_database_url.

recon_gen.common.datasource.build_datasource(cfg)[source]

Build a QuickSight DataSource from cfg.demo_database_url.

Dispatches on cfg.dialect:

  • Postgres: Type="POSTGRESQL" + PostgreSqlParameters (port defaults 5432, database defaults postgres).

  • Oracle: Type="ORACLE" + OracleParameters (port defaults 1521, Database carries the service name / SID — accepted by QuickSight’s create-data-source for either Easy Connect or SQLAlchemy-style URLs).

  • SQLite: not supported by AWS QuickSight as a datasource type. The SQLite dialect is the integrator’s local-iteration storage for the X.2 self-hosted renderer (X.3.e), not a deployable QuickSight backend. Calling build_datasource against a SQLite config raises ValueError with a pointer to the local-loop docs.

The DataSource ID derives from cfg.prefixed("demo-datasource") (i.e. <deployment_name>-demo-datasource) so each per-deploy deployment_name gets its own unique ID — per-test harness + multi-tenant deploys are isolated. Credentials come from the parsed URL; SSL is enabled by default; principal_arns from cfg become QS Permissions.

Raises ValueError if cfg.demo_database_url is unset, or if the dialect is SQLite (QuickSight has no SQLite datasource type).

Return type:

DataSource

Parameters:

cfg (Config)