If you're pulling Stripe data for reporting, you've probably faced the choice: export CSVs manually or write custom API calls. Sigma SQL is Stripe's answer—a built-in SQL editor in your dashboard that lets you query your entire payment database directly. You get instant answers on charges, customers, subscriptions, and invoices without leaving Stripe or writing backend code.
Accessing Sigma from Your Dashboard
Sigma is already available in your Stripe account—you just need to know where to find it.
Open Sigma in the Stripe Dashboard
Log into your Stripe account and navigate to Developers in the left sidebar. Click Sigma (you'll see it listed below Webhooks and API keys). If you don't see it, ensure you have Admin or Developer permissions, or contact Stripe support to enable it.
// Access Stripe data via API (what Sigma queries do behind the scenes)
const stripe = require('stripe')('sk_test_...');
// Example: Fetch recent charges programmatically
const charges = await stripe.charges.list({
limit: 10,
created: {
gte: Math.floor(Date.now() / 1000) - 7 * 24 * 60 * 60
}
});
console.log(`Found ${charges.data.length} charges from last 7 days`);Verify the SQL Editor Is Ready
You should see the Sigma editor with a blank query pane on the left and a Schema panel showing your available tables. The editor has SQL syntax highlighting. If Sigma is grayed out, you may lack the required permissions.
// Example: Stripe SDK method to list customers (mirrors what you'd query in Sigma)
const stripe = require('stripe')('sk_test_...');
const customers = await stripe.customers.list({
limit: 5
});
customers.data.forEach(cust => {
console.log(`${cust.email} - Created: ${new Date(cust.created * 1000).toLocaleDateString()}`);
});Understanding the Sigma Schema
Before you write queries, you need to know what tables and columns are available.
Explore the Schema Panel
In the Sigma editor, click the Schema tab to see all available tables. The main ones are: charges (payments), customers (customer records), subscriptions (recurring billing), invoices (billing documents), and payment_intents (modern payment tracking). Click each table to see its columns and data types.
-- Example Sigma SQL: Inspect the charges table structure
-- Run this in Sigma to see real data and column names
SELECT
id,
amount,
currency,
created,
status,
customer,
description
FROM charges
LIMIT 5;Understand Key Relationships
Charges and subscriptions both link to customers via the customer column. Invoices link to subscriptions via subscription_id. Learn these relationships so you can JOIN tables effectively. For example, to get a customer's total spend, you JOIN customers to charges on customers.id = charges.customer.
-- Example Sigma SQL: Join customers and charges
SELECT
c.id,
c.email,
COUNT(ch.id) as total_charges,
SUM(ch.amount) / 100 as total_spent_usd
FROM customers c
LEFT JOIN charges ch ON c.id = ch.customer
WHERE ch.created >= DATE_SUB(NOW(), INTERVAL 90 DAY)
GROUP BY c.id, c.email
ORDER BY total_spent_usd DESC
LIMIT 10;Writing and Running Your First Query
Start with a simple query and build from there.
Write a Basic SELECT Query
Click in the query editor and type a simple query. Start with a single table—for example, get the last 5 charges. Sigma highlights SQL syntax as you type. Keep it simple: SELECT, FROM, and a LIMIT to start.
-- Your first Sigma query: Last 5 charges
SELECT
id,
amount,
currency,
status,
created
FROM charges
ORDER BY created DESC
LIMIT 5;Run the Query and Review Results
Click the Run button (play icon) in the editor. Your query executes against live Stripe data, and results appear in the pane below. If there's a syntax error, Stripe highlights it and shows an error message. If the query times out, add a date filter or LIMIT to reduce scope.
-- Example Sigma query with date filtering (prevents timeouts)
SELECT
DATE(FROM_UNIXTIME(created)) as date,
COUNT(*) as transaction_count,
SUM(amount) / 100 as daily_volume_usd
FROM charges
WHERE status = 'succeeded'
AND created >= DATE_SUB(NOW(), INTERVAL 30 DAY)
GROUP BY DATE(FROM_UNIXTIME(created))
ORDER BY date DESC;Export Your Results
Once your query returns results, look for the Export or Download button above the results table. Click it to download as CSV. Import the file into your analytics tool, spreadsheet, or reporting system.
// Process Sigma CSV export in Node.js
const fs = require('fs');
const csv = require('csv-parse/sync');
const fileContent = fs.readFileSync('sigma_results.csv', 'utf-8');
const records = csv.parse(fileContent, { columns: true });
// Example: Log the data
records.forEach(row => {
console.log(`${row.date}: ${row.transaction_count} transactions, $${row.daily_volume_usd}`);
});
// Or upload to your database
records.forEach(record => {
// INSERT into your analytics database
});
console.log(`Imported ${records.length} rows from Sigma`);WHERE created >= DATE_SUB(NOW(), INTERVAL N DAY) until you're confident in performance.Common Pitfalls
- Querying your entire payment history without date filters—Sigma will timeout. Always use
WHERE created >= DATE_SUB(NOW(), INTERVAL 30 DAY)or similar to scope the query. - Forgetting that subscription and one-off charge data are separate tables—subscriptions and charges don't automatically join. You must explicitly
JOIN subscriptions ON charges.subscription_id = subscriptions.idif you need both. - Using REST API column names instead of Sigma schema names—the API response format differs from Sigma's SQL schema. Check the Schema panel in Sigma, not the API docs, for exact column names.
- Assuming Sigma is write-enabled—it's read-only. You can query and export data, but you can't INSERT, UPDATE, or DELETE. Use the Stripe API for writes.
Wrapping Up
You now have direct SQL access to your Stripe data without waiting for API calls or manual exports. Start with simple queries on charges, then JOIN multiple tables as you get comfortable with the schema. If you want to track this automatically across tools, Product Analyst can help.