---
title: "OpenAI Codex + Rig: Query Your Warehouse Data in OpenAI Codex"
description: "Connect your warehouse to OpenAI Codex with Rig. Ask data questions in plain English and get governed, validated SQL answers. Snowflake, BigQuery, Redshift, Postgres and more."
canonical: "https://rig.so/integrations/codex"
format: markdown
---

Browse integrations

![OpenAI Codex logo](https://img.logo.dev/openai.com?token=pk_AdkTbLWDS1iunmvTK2qm1g&size=112&format=png&retina=true)

AI tools Supported

# 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.

[Try Rig](https://app.rig.so/signup)[Book a demo](https://rig.so/book-demo)

## 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.

[Read the step-by-step guide to connecting Rig to OpenAI Codex](https://rig.so/guides/connect-ai-tools)

## 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.

Ask Rig

- 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.

Ask Rig

- 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.

Ask Rig

- 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.

Ask Rig

- 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

[![ChatGPT logo](https://img.logo.dev/openai.com?token=pk_AdkTbLWDS1iunmvTK2qm1g&size=72&format=png&retina=true)ChatGPTAsk your warehouse questions in ChatGPT and get governed, validated answers.](https://rig.so/integrations/chatgpt)[![Claude logo](https://img.logo.dev/claude.ai?token=pk_AdkTbLWDS1iunmvTK2qm1g&size=72&format=png&retina=true)ClaudeAsk questions of your warehouse in Claude, with governed SQL behind every answer.](https://rig.so/integrations/claude)[![Claude Code logo](https://img.logo.dev/claude.com?token=pk_AdkTbLWDS1iunmvTK2qm1g&size=72&format=png&retina=true)Claude CodeQuery and build with warehouse data from the Claude Code terminal.](https://rig.so/integrations/claude-code)[![Cursor logo](https://img.logo.dev/cursor.com?token=pk_AdkTbLWDS1iunmvTK2qm1g&size=72&format=png&retina=true)CursorBring governed warehouse data into Cursor for data-aware coding.](https://rig.so/integrations/cursor)[![Google Gemini logo](https://img.logo.dev/gemini.google.com?token=pk_AdkTbLWDS1iunmvTK2qm1g&size=72&format=png&retina=true)Google GeminiQuery your warehouse from Gemini and the Gemini CLI with governed SQL.](https://rig.so/integrations/gemini)[![VS Code logo](https://img.logo.dev/visualstudio.com?token=pk_AdkTbLWDS1iunmvTK2qm1g&size=72&format=png&retina=true)VS CodeQuery your warehouse from VS Code and GitHub Copilot over MCP.](https://rig.so/integrations/vs-code)

## 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.

[Try Rig](https://app.rig.so/signup)[Book a demo](https://rig.so/book-demo)

---

- [This page as HTML](https://rig.so/integrations/codex)
- [Site map for language models](https://rig.so/llms.txt)
- [API and agent documentation](https://rig.so/developers)
