OpenAI Codex + Rig
The easiest way to query your warehouse data in OpenAI Codex
Codex is OpenAI's agentic coding tool that runs in the terminal, IDE and cloud and connects to external tools and data over MCP.
What Rig gives OpenAI Codex
Once connected, OpenAI Codex can reason over your governed data through Rig:
- Warehouse tables and views
- Metric definitions
- Join paths
- dbt lineage
- Role-based access
- Sandbox-validated SQL
How OpenAI Codex connects to Rig
Add Rig as an MCP server for Codex. It can then query your warehouse with governed SQL as it codes, so the analyses, scripts and dashboards it produces are grounded in real, validated data.
Build on real warehouse data with Codex
With Rig connected, Codex writes code against your actual schema and metric definitions. It pulls correct joins and live numbers as it works, so generated reports and components reflect the warehouse, not placeholder data.
- Build a script that exports weekly active users
- Generate the SQL for revenue by region and wire it in
- What does the events table look like?
Answer data questions inline
Codex can run ad-hoc data questions through Rig while you build, returning validated numbers without a context switch to a SQL client.
- How many orders shipped yesterday?
- Show a sample of the customers table
- Find the join from sessions to purchases
Keep generated queries governed
Rig sandbox-validates each query and runs read-only, so Codex cannot mutate production or run an unbounded scan. Answers use your agreed metric definitions.
- Validate this query before running it
- Recompute with the official retention metric
- Add a limit and re-run that
Promote analysis into automation
Because Rig governs the data path, work Codex produces can become a scheduled job or a downstream action that reuses the same context and definitions.
- Schedule this report to run every Monday
- Write a job that flags churn risk nightly
- Document the metrics this script depends on
Frequently asked questions
- How do I connect Codex to my warehouse?
- Add Rig as an MCP server for Codex. Rig builds the context layer over your warehouse and Codex can then query it with governed SQL.
- Can Codex build on my real schema?
- Yes. With Rig connected, Codex reads your real tables, joins and metric definitions and builds against them.
- Is the access read-only?
- Yes. Rig connects read-only and validates each query in a sandbox before it runs.
- Which warehouses are supported?
- Snowflake, BigQuery, Redshift, Postgres and DuckDB/MotherDuck, plus SaaS sources synced by Rig Ingest.
Related integrations
Connect your warehouse to OpenAI Codex
Rig builds a governed context layer over your data so every team, and every AI tool, asks questions and gets answers they can trust.