An Informatica mapping-to-SQL converter. This CLI reads Informatica IDMC (JSON) workflow documents and generates ANSI SQL for each mapping using an LLM (OpenAI). It can print SQL to stdout or write a single SQL file per input.
- Python 3.11+
uvinstalled (https://docs.astral.sh/uv/)
# Create and sync a local environment
make bootstrap
# Run the converter (LLM-powered; prints ANSI SQL for each mapping)
make run ARGS=path/to/workflow.json # or: uv run python -m codex_test path/to/workflow.json
codex-test path/to/workflow.json # installed via editable package
# Run checks
make fmt && make lint && make typecheck
make test # or: make coverage- Provider: OpenAI (default model
OPENAI_MODELenv, fallbackgpt-5-mini) - Auth/Config: set
OPENAI_API_KEYand optionallyOPENAI_MODELin your environment or copy.env.exampleto.envand set them there (loaded in dev ifpython-dotenvis installed). - CLI:
codex-test path/to/workflow.json→ prints model-generated SQL for IDMC JSONcodex-llm path/to/workflow.json→ equivalent direct LLM entrypoint
- Command:
codex-agents path/to/workflow.json - Uses the OpenAI Agents SDK with a simple file-reading tool to load the workflow JSON and emit ANSI SQL.
- Env:
OPENAI_API_KEY(required),OPENAI_MODEL(optional; defaults togpt-5-minifor this CLI)
- Module:
codex_test - CLI:
codex-test - Example:
codex-test path/to/workflow.json→ emits SQL per mapping on stdout (via OpenAI)codex-test path/to/workflow.json --output-dir output/→ writes<stem>.sqlwith all generated SQL
- Input formats:
- IDMC workflow JSON
- What it does:
- Parses mappings and converts them to ANSI-SQL statements.
- Generates
INSERT INTO ... SELECT ...for each mapping/target.
- LLM behavior:
- Accepts
source/sourcesandtarget/targetskeys. - Reads fields from varied shapes:
fields,columns,ports,schema.fields,items(recursively flattened and de-duplicated, order preserved).
- Accepts
-
- May use JOIN ... USING when sources share columns; otherwise CROSS JOIN where needed.
-
- If a target column is not found, may project
NULL AS <col>.
- If a target column is not found, may project
- Output options:
- Print SQL to stdout (default).
- Write files with
--output-dir output/(writes<stem>.sql).
- Simple (IDMC JSON):
{
"mappings": [
{
"name": "m_simple",
"source": {"name": "SRC_TABLE", "fields": ["id", "name"]},
"target": {"name": "TGT_TABLE", "fields": ["id", "name"]}
}
]
}- Output (generated SQL; output may vary slightly):
-- Mapping: m_simple -> TGT_TABLE
INSERT INTO TGT_TABLE (id, name)
SELECT id, name
FROM SRC_TABLE;- Multi-source join (IDMC JSON):
{
"mappings": [
{
"name": "m_join",
"sources": [
{"name": "SRC_A", "fields": ["id", "name"]},
{"name": "SRC_B", "fields": ["id", "amount"]}
],
"target": {"name": "TGT", "fields": ["id", "name", "amount"]}
}
]
}- Output (generated SQL; output may vary slightly):
-- Mapping: m_join -> TGT
INSERT INTO TGT (id, name, amount)
SELECT id, SRC_A.name, SRC_B.amount
FROM SRC_A
JOIN SRC_B USING (id);- Advanced Informatica transformations (expressions, filters, lookups, aggregations, conditional logic, etc.) are not currently modeled.
- Join inference relies on identical column names across sources; aliasing or mapping logic is not interpreted.
- Generated SQL is ANSI-oriented and does not apply vendor-specific dialect features.
.
├── src/codex_test/ # Package code (CLI + library)
├── tests/ # Pytest test suite
├── scripts/ # Helper scripts (dev, test)
├── pyproject.toml # Project metadata & tooling config
├── Makefile # Common developer tasks (uv-powered)
├── AGENTS.md # Contributor guide
└── .pre-commit-config.yaml# Local lint/type hooks
make bootstrap: Create venv (uv venv) and install deps (uv sync --extra dev).make fmt/make lint: Format with Black and Ruff; run lint checks.make typecheck: Run Mypy onsrc/.make test/make coverage: Run tests (optionally with coverage report).make run: Execute the CLI via module entry point.make lock: Generate/updateuv.lockand sync environment.
See AGENTS.md for coding style, testing, commit/PR guidance, and security notes. Install Git hooks with: uv run pre-commit install.
Add a LICENSE file to define the project’s license (e.g., MIT, Apache-2.0). Until then, all rights reserved.