Skip to content

Mixpanel

Mixpanel raw events, reports, user profiles, cohorts and Lexicon definitions as SQL tables

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/mixpanel/index.md to help me query Mixpanel with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Find today’s most common product events

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT event, amount
FROM mixpanel.main.top_events()
ORDER BY amount DESC
LIMIT 5

Quick start

Choose where to run Mixpanel, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'mixpanel' AS mixpanel (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-mixpanel'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

mixpanel credentials

Mixpanel service account (or project API secret), project id and data residency region

Get these credentials →
secret.sql
CREATE SECRET mixpanel (
    TYPE mixpanel,
    username     '<username>',
    secret       '<MIXPANEL_SECRET>',  -- secret
    project_id   '<project_id>',
    region       '<region>',
    api_secret   '<MIXPANEL_API_SECRET>',  -- secret
    workspace_id '<workspace_id>',
    base_url     '<base_url>'
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT event, amount
FROM mixpanel.main.top_events()
ORDER BY amount DESC
LIMIT 5
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'mixpanel' AS mixpanel (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

Mixpanel product analytics as SQL: raw events, segmentation, funnels, retention, user profiles, cohorts and the Lexicon, read-only.

Catalog

Everything mixpanel exposes once attached — read straight from the worker's released build.

mixpanel 2 schemas
main 5 tables · 9 functions

Mixpanel-native objects: raw events, Query API reports, user profiles, cohorts, Lexicon schemas and annotations.

Schema examples (12)
Examples (12)

Sign-ups per operating system over three days (event name and dates are sent to Mixpanel)

SELECT os, count(*) AS signups
FROM mixpanel.main.events()
WHERE event_name = 'Sign Up' AND event_time >= TIMESTAMPTZ '2026-11-01' AND event_time < TIMESTAMPTZ '2026-11-04'
GROUP BY os
ORDER BY signups DESC;

Revenue per user from Purchase events

SELECT distinct_id, count(*) AS purchases,
  sum((properties->>'revenue')::DOUBLE) AS revenue
FROM mixpanel.main.events(from_date := '2026-11-01', to_date := '2026-11-03')
WHERE event_name = 'Purchase'
GROUP BY distinct_id
ORDER BY revenue DESC;

Daily sign-ups over three days

SELECT period_start::DATE AS day, value AS signups
FROM mixpanel.main.segmentation('Sign Up', '2026-11-01', '2026-11-03')
ORDER BY day;

Sign-ups per operating system

SELECT segment AS os, sum(value) AS signups
FROM mixpanel.main.segmentation('Sign Up', '2026-11-01', '2026-11-03', segment_by := 'properties["$os"]')
GROUP BY os
ORDER BY signups DESC;
8 more examples

Weekly conversion of each step of funnel 7509

SELECT step, event, count, round(overall_conv_ratio, 3) AS conversion
FROM mixpanel.main.funnel(7509, '2026-11-02', '2026-11-08', unit := 'week')
ORDER BY step;

Day-1 retention of each day's sign-ups

SELECT cohort_date, round(retention_rate, 3) AS day1
FROM mixpanel.main.retention('2026-11-01', '2026-11-03', born_event := 'Sign Up')
WHERE period = 1
ORDER BY cohort_date;

Five most common events today

SELECT event, amount
FROM mixpanel.main.top_events()
ORDER BY amount DESC
LIMIT 5;

Ten most common event names

SELECT event_name FROM mixpanel.main.event_names() ORDER BY rank LIMIT 10;

Properties of Purchase events by frequency

SELECT property_name, count
FROM mixpanel.main.top_event_properties('Purchase')
ORDER BY count DESC;

Plans seen on Purchase events

SELECT value AS plan
FROM mixpanel.main.event_property_values('Purchase', 'plan')
ORDER BY rank;

Users on the pro plan (filtered by Mixpanel)

SELECT email, created_at
FROM mixpanel.main.profiles(where_expr := 'properties["plan"] == "pro"')
ORDER BY created_at;

Users per country

SELECT country_code, count(*) AS users
FROM mixpanel.main.profiles()
GROUP BY country_code
ORDER BY users DESC;
Tables
annotations 1 example6 cols

Chart annotations (releases, campaigns, incidents) with their dates

Columns
idnot null BIGINT
Annotation identifier (integer, assigned by Mixpanel).
annotation_time TIMESTAMP WITH TIME ZONE
When the annotation is placed (read as UTC).
description VARCHAR
Annotation text.
author_id BIGINT
Numeric Mixpanel account id of the author (not a tracked user).
author_name VARCHAR
Name of the Mixpanel account that wrote the annotation.
tags VARCHAR[]
Tag names.
ConstraintsPRIMARY KEY (id)
Example

Annotations since November 1 (the date bound is sent to Mixpanel)

SELECT annotation_time, description
FROM mixpanel.main.annotations
WHERE annotation_time >= TIMESTAMPTZ '2026-11-01'
ORDER BY annotation_time;
Link
cohorts 1 example7 cols

Saved cohorts with their current size

Columns
idnot null BIGINT
Numeric cohort identifier; pass it to profiles(cohort_id := ...).
name VARCHAR
Cohort name.
description VARCHAR
Free-text note the cohort author wrote.
count BIGINT
Current number of users in the cohort.
is_visible BOOLEAN
Shown in the Mixpanel UI.
created_at TIMESTAMP WITH TIME ZONE
When the cohort was created (read as UTC).
project_id BIGINT
Mixpanel project identifier (integer) the cohort belongs to.
ConstraintsPRIMARY KEY (id)
Example

Cohorts by size

SELECT name, count FROM mixpanel.main.cohorts ORDER BY count DESC;
Link
funnels 1 example2 cols

Saved funnels of the project (id and name), for use with funnel()

Columns
funnel_idnot null BIGINT
Numeric saved-funnel identifier; pass it to funnel().
name VARCHAR
Funnel name as shown in Mixpanel.
ConstraintsPRIMARY KEY (funnel_id)
Example

Saved funnels

SELECT funnel_id, name FROM mixpanel.main.funnels ORDER BY name;
Link
schema_properties 1 example10 cols

Lexicon property definitions: one row per property of each event or profile schema

Columns
entity_typenot null VARCHAR
'event' or 'profile'.
entity_namenot null VARCHAR
Event (or profile entity) the property belongs to.
property_namenot null VARCHAR
Property key as sent with events or set on profiles.
data_type VARCHAR
JSON Schema type: string, number, integer, boolean, array, object.
description VARCHAR
Lexicon documentation of the property.
display_name VARCHAR
Friendly label shown in Mixpanel reports.
is_hidden BOOLEAN
Hidden in the UI.
is_dropped BOOLEAN
Dropped at ingestion.
is_required BOOLEAN
Listed as required by the schema.
enum_values VARCHAR[]
Allowed values, when the schema has an enum.
ConstraintsPRIMARY KEY (entity_type, entity_name, property_name)
Example

Properties defined for the Purchase event

SELECT property_name, data_type
FROM mixpanel.main.schema_properties
WHERE entity_type = 'event' AND entity_name = 'Purchase'
ORDER BY property_name;
Link
schemas 1 example11 cols

Lexicon data dictionary: one row per event or user-profile schema

Columns
entity_typenot null VARCHAR
'event' or 'profile'.
namenot null VARCHAR
Event name (or '$user' style profile entity name).
display_name VARCHAR
Friendly label shown in Mixpanel reports instead of the raw name.
description VARCHAR
Lexicon documentation of the event or profile.
is_hidden BOOLEAN
Hidden in the Mixpanel UI.
is_dropped BOOLEAN
Data is dropped at ingestion (events only).
tags VARCHAR[]
Lexicon tags.
contacts VARCHAR[]
Owner emails.
team_contacts VARCHAR[]
Owning teams.
property_count INTEGER
Properties defined in the schema.
schema_json JSON
The full JSON Schema document.
ConstraintsPRIMARY KEY (entity_type, name)
Example

Hidden events in the Lexicon

SELECT name, description
FROM mixpanel.main.schemas
WHERE entity_type = 'event' AND is_hidden
ORDER BY name;
Link
Table functions
event_names (count_type := VARCHAR, max_events := INTEGER) 1 example

Names of the project's most common events over the last 31 days

Named arguments
count_type := VARCHAR
general (all events), unique (unique users) or average. · default "general"
max_events := INTEGER
Number of names to return (1-10000). · default 255
Returns columns
rank INTEGER
Rank by volume (1 = most common).
event_name VARCHAR
Event name.
Example

Ten most common event names

SELECT event_name FROM mixpanel.main.event_names() ORDER BY rank LIMIT 10;
Link
event_property_values (event VARCHAR, property_name VARCHAR, max_values := INTEGER) 1 example

The most common values of one event property over the last 31 days

Positional arguments
event VARCHAR
Event name, e.g. 'Purchase'.
property_name VARCHAR
Property name, e.g. 'plan' or '$os'.
Named arguments
max_values := INTEGER
Number of values (1-10000). · default 255
Returns columns
rank INTEGER
Rank by frequency (1 = most common).
value VARCHAR
Property value.
Example

Plans seen on Purchase events

SELECT value AS plan
FROM mixpanel.main.event_property_values('Purchase', 'plan')
ORDER BY rank;
Link
events (chunk_days := INTEGER, from_date := VARCHAR, lookback_days := INTEGER, to_date := VARCHAR, where_expr := VARCHAR) 2 examples

Raw Mixpanel events from the Raw Event Export API, streamed day range by day range

Named arguments
chunk_days := INTEGER
Days per export request (default 7). The export API allows 60 requests per hour. · default 7
from_date := VARCHAR
First day to export, 'YYYY-MM-DD' (inclusive). Default: from an event_time filter, else today - lookback_days + 1. · default null
lookback_days := INTEGER
Days read when there is no lower bound on event_time or from_date (default 7). · default 7
to_date := VARCHAR
Last day to export, 'YYYY-MM-DD' (inclusive). Default: from an event_time filter, else today (UTC). · default null
where_expr := VARCHAR
A Mixpanel segmentation expression sent as the export `where`, e.g. 'properties["plan"] == "pro"'. · default null
Returns columns
event_name VARCHAR
Event name, e.g. 'Sign Up'.
event_time TIMESTAMP WITH TIME ZONE
When the event happened (UTC; the `time` property).
distinct_id VARCHAR
The id Mixpanel resolves the user by (distinct_id).
insert_id VARCHAR
Client deduplication id ($insert_id).
device_id VARCHAR
Anonymous device id ($device_id).
user_id VARCHAR
Identified user id ($user_id, simplified ID merge).
os VARCHAR
Operating system ($os).
browser VARCHAR
Browser ($browser).
device VARCHAR
Device model ($device / $model).
city VARCHAR
City from IP geolocation ($city).
region VARCHAR
Region or state ($region).
country_code VARCHAR
ISO country code from IP geolocation (mp_country_code).
current_url VARCHAR
Page URL for web events ($current_url).
app_version VARCHAR
App version ($app_version_string).
lib VARCHAR
SDK that sent the event (mp_lib), e.g. 'web', 'iphone', 'android', 'python'.
lib_version VARCHAR
SDK version ($lib_version).
processing_time TIMESTAMP WITH TIME ZONE
When Mixpanel ingested the event (mp_processing_time_ms).
properties JSON
Every event property as a JSON object, including the $-prefixed defaults.
Examples (2)

Sign-ups per operating system over three days (event name and dates are sent to Mixpanel)

SELECT os, count(*) AS signups
FROM mixpanel.main.events()
WHERE event_name = 'Sign Up' AND event_time >= TIMESTAMPTZ '2026-11-01' AND event_time < TIMESTAMPTZ '2026-11-04'
GROUP BY os
ORDER BY signups DESC;

Revenue per user from Purchase events

SELECT distinct_id, count(*) AS purchases,
  sum((properties->>'revenue')::DOUBLE) AS revenue
FROM mixpanel.main.events(from_date := '2026-11-01', to_date := '2026-11-03')
WHERE event_name = 'Purchase'
GROUP BY distinct_id
ORDER BY revenue DESC;
Link
funnel (funnel_id BIGINT, from_date VARCHAR, to_date VARCHAR, funnel_window := INTEGER, unit := VARCHAR, where_expr := VARCHAR, window_unit := VARCHAR) 1 example

A saved funnel's step counts and conversion per period from the Query API funnels report

Positional arguments
funnel_id BIGINT
Saved funnel id (see mixpanel.main.funnels).
from_date VARCHAR
First day, 'YYYY-MM-DD' (inclusive).
to_date VARCHAR
Last day, 'YYYY-MM-DD' (inclusive).
Named arguments
funnel_window := INTEGER
Time a user has to complete the funnel, in window_unit (Mixpanel `length`). · default null
unit := VARCHAR
Bucket: day, week or month (default: Mixpanel's 1-day interval). · default null
where_expr := VARCHAR
Mixpanel expression filtering the events. · default null
window_unit := VARCHAR
Unit of funnel_window: day, hour, minute or second. · default null
Returns columns
period_start DATE
First day of the period.
step INTEGER
Step number, 1-based.
step_count INTEGER
Number of steps in the funnel.
event VARCHAR
Event of the step (or $custom_event:<id>).
goal VARCHAR
Step goal as Mixpanel names it.
step_label VARCHAR
Display label of a custom-event step.
count BIGINT
Users who reached this step in the period.
step_conv_ratio DOUBLE
Conversion from the previous step (1.0 for step 1).
overall_conv_ratio DOUBLE
Conversion from the first step.
avg_time DOUBLE
Average seconds from the previous step.
avg_time_from_start DOUBLE
Average seconds from the first step.
Example

Weekly conversion of each step of funnel 7509

SELECT step, event, count, round(overall_conv_ratio, 3) AS conversion
FROM mixpanel.main.funnel(7509, '2026-11-02', '2026-11-08', unit := 'week')
ORDER BY step;
Link
profiles (cohort_id := BIGINT, where_expr := VARCHAR) 2 examples

User profiles from the Engage API, paged by session id

Named arguments
cohort_id := BIGINT
Only members of this cohort (see mixpanel.main.cohorts). · default null
where_expr := VARCHAR
Mixpanel expression over profile properties, e.g. 'properties["plan"] == "pro"'. · default null
Returns columns
distinct_id VARCHAR
The profile's distinct_id.
email VARCHAR
$email.
name VARCHAR
$name, else first and last name.
first_name VARCHAR
$first_name.
last_name VARCHAR
$last_name.
phone VARCHAR
$phone.
city VARCHAR
$city.
region VARCHAR
$region.
country_code VARCHAR
$country_code.
timezone VARCHAR
$timezone.
os VARCHAR
$os (last seen).
created_at TIMESTAMP WITH TIME ZONE
$created (read as UTC).
last_seen_at TIMESTAMP WITH TIME ZONE
$last_seen (read as UTC).
properties JSON
Every profile property as a JSON object.
Examples (2)

Users on the pro plan (filtered by Mixpanel)

SELECT email, created_at
FROM mixpanel.main.profiles(where_expr := 'properties["plan"] == "pro"')
ORDER BY created_at;

Users per country

SELECT country_code, count(*) AS users
FROM mixpanel.main.profiles()
GROUP BY country_code
ORDER BY users DESC;
Link
retention (from_date VARCHAR, to_date VARCHAR, born_event := VARCHAR, born_where := VARCHAR, interval_count := INTEGER, retention_type := VARCHAR, return_event := VARCHAR, unit := VARCHAR, where_expr := VARCHAR) 1 example

Cohort retention (users per cohort date and period) from the Query API retention report

Positional arguments
from_date VARCHAR
First cohort day, 'YYYY-MM-DD' (inclusive).
to_date VARCHAR
Last cohort day, 'YYYY-MM-DD' (inclusive).
Named arguments
born_event := VARCHAR
Event that starts a cohort (required when retention_type is birth), e.g. 'Sign Up'. · default null
born_where := VARCHAR
Mixpanel expression filtering the born events. · default null
interval_count := INTEGER
Number of periods after period 0 (1-90). · default 7
retention_type := VARCHAR
birth (first occurrence of born_event) or compounded (any occurrence). · default "birth"
return_event := VARCHAR
Event that counts as returning (default: any event). · default null
unit := VARCHAR
Period length: day, week or month. · default "day"
where_expr := VARCHAR
Mixpanel expression filtering the return events. · default null
Returns columns
cohort_date DATE
Day the cohort was born (start of the cohort period).
cohort_size BIGINT
Users in the cohort.
period INTEGER
Periods after the cohort date (0 = the cohort period itself).
retained BIGINT
Users from the cohort active in this period.
retention_rate DOUBLE
retained / cohort_size.
Example

Day-1 retention of each day's sign-ups

SELECT cohort_date, round(retention_rate, 3) AS day1
FROM mixpanel.main.retention('2026-11-01', '2026-11-03', born_event := 'Sign Up')
WHERE period = 1
ORDER BY cohort_date;
Link
segmentation (event VARCHAR, from_date VARCHAR, to_date VARCHAR, count_type := VARCHAR, segment_by := VARCHAR, segment_limit := INTEGER, unit := VARCHAR, where_expr := VARCHAR) 2 examples

Event counts per period (optionally per property value) from the Query API segmentation report

Positional arguments
event VARCHAR
The event to count, e.g. 'Sign Up'.
from_date VARCHAR
First day, 'YYYY-MM-DD' (inclusive, project time zone).
to_date VARCHAR
Last day, 'YYYY-MM-DD' (inclusive).
Named arguments
count_type := VARCHAR
general (every event), unique (unique users) or average (events per user). · default "general"
segment_by := VARCHAR
Property expression to break down by, e.g. 'properties["$os"]' (Mixpanel `on`). · default null
segment_limit := INTEGER
Top segment values returned when segment_by is set (1-10000). · default 60
unit := VARCHAR
Bucket size: minute, hour, day, week or month. · default "day"
where_expr := VARCHAR
Mixpanel expression filtering the events, e.g. 'properties["plan"] == "pro"'. · default null
Returns columns
event VARCHAR
Event name.
segment VARCHAR
Value of the segment_by property (NULL when not segmented).
period VARCHAR
Mixpanel's bucket label, e.g. '2026-11-01' or '2026-11-01 10:00:00'.
period_start TIMESTAMP
Bucket start in the project's time zone.
value DOUBLE
The count (or average) for the bucket.
Examples (2)

Daily sign-ups over three days

SELECT period_start::DATE AS day, value AS signups
FROM mixpanel.main.segmentation('Sign Up', '2026-11-01', '2026-11-03')
ORDER BY day;

Sign-ups per operating system

SELECT segment AS os, sum(value) AS signups
FROM mixpanel.main.segmentation('Sign Up', '2026-11-01', '2026-11-03', segment_by := 'properties["$os"]')
GROUP BY os
ORDER BY signups DESC;
Link
top_event_properties (event VARCHAR, max_properties := INTEGER) 1 example

The most common properties of one event over the last 31 days, with counts

Positional arguments
event VARCHAR
Event name, e.g. 'Purchase'.
Named arguments
max_properties := INTEGER
Number of properties (1-1000). · default 10
Returns columns
property_name VARCHAR
Property name.
count BIGINT
Events carrying the property.
Example

Properties of Purchase events by frequency

SELECT property_name, count
FROM mixpanel.main.top_event_properties('Purchase')
ORDER BY count DESC;
Link
top_events (count_type := VARCHAR, max_events := INTEGER) 1 example

Today's most common events with their counts and change versus yesterday

Named arguments
count_type := VARCHAR
general (all events), unique (unique users) or average. · default "general"
max_events := INTEGER
Number of events to return (1-1000). · default 100
Returns columns
event VARCHAR
Event name.
amount BIGINT
Count so far today.
percent_change DOUBLE
Change versus the same time yesterday (0.1 = +10%).
Example

Five most common events today

SELECT event, amount
FROM mixpanel.main.top_events()
ORDER BY amount DESC
LIMIT 5;
Link
unified 5 tables

Mixpanel events, users, cohorts and definitions in the shape shared with the Amplitude and PostHog workers.

Schema examples (5)
Examples (5)

Active users per platform over three days

SELECT platform, count(DISTINCT distinct_id) AS users
FROM mixpanel.unified.events
WHERE event_time >= TIMESTAMPTZ '2026-11-01' AND event_time < TIMESTAMPTZ '2026-11-04'
GROUP BY platform
ORDER BY users DESC;

Users per country

SELECT country, count(*) AS users
FROM mixpanel.unified.users
GROUP BY country
ORDER BY users DESC;

Cohorts by size

SELECT tool, name, size FROM mixpanel.unified.cohorts ORDER BY size DESC;

Visible events of the tracking plan

SELECT event_name, description
FROM mixpanel.unified.event_definitions
WHERE NOT is_hidden
ORDER BY event_name;
1 more example

Properties per scope

SELECT scope, count(*) AS properties
FROM mixpanel.unified.property_definitions
GROUP BY scope
ORDER BY scope;
Tables
cohorts 1 example9 cols

Cohorts in the shared product-analytics shape (tool, id, name, size, timestamps, definition)

Columns
toolnot null VARCHAR
The analytics tool the row came from: 'mixpanel'.
idnot null VARCHAR
Mixpanel cohort id as text (profiles(cohort_id := ...) lists members).
name VARCHAR
Cohort name.
description VARCHAR
Free-text note the cohort author wrote.
size BIGINT
Number of users currently in the cohort.
created_at TIMESTAMP WITH TIME ZONE
Created.
updated_at TIMESTAMP WITH TIME ZONE
Last modified (not reported by Mixpanel: NULL).
is_archived BOOLEAN
Archived (not reported by Mixpanel: NULL).
definition JSON
Tool-specific definition (not reported by Mixpanel: NULL).
ConstraintsPRIMARY KEY (id)
Example

Cohorts by size

SELECT tool, name, size FROM mixpanel.unified.cohorts ORDER BY size DESC;
Link
event_definitions 1 example9 cols

Event definitions in the shared product-analytics shape (name, description, category, volume)

Columns
toolnot null VARCHAR
The analytics tool the row came from: 'mixpanel'.
event_namenot null VARCHAR
Raw event name as tracked by the SDKs.
display_name VARCHAR
Friendly label shown in Mixpanel reports.
description VARCHAR
Lexicon documentation of the event.
category VARCHAR
Category (Mixpanel: NULL).
is_hidden BOOLEAN
Hidden in the tool's UI.
is_active BOOLEAN
Receiving data (Mixpanel: not dropped).
volume BIGINT
Recent volume (Mixpanel: NULL).
tags VARCHAR[]
Lexicon tags used to group events.
ConstraintsPRIMARY KEY (event_name)
Example

Visible events of the tracking plan

SELECT event_name, description
FROM mixpanel.unified.event_definitions
WHERE NOT is_hidden
ORDER BY event_name;
Link
events 1 example19 cols

Raw events in the shared product-analytics shape (tool, event_name, event_time, ids, properties …)

Columns
toolnot null VARCHAR
The analytics tool the row came from: 'mixpanel'.
uuidnot null VARCHAR
The tool's unique event id. Mixpanel has none: the $insert_id, else 'mp:<distinct_id>:<time ms>:<event>'.
event_namenot null VARCHAR
Event name as sent by the SDK, e.g. 'Sign Up'.
event_timenot null TIMESTAMP WITH TIME ZONE
When the event happened (UTC).
received_time TIMESTAMP WITH TIME ZONE
When the tool received the event (Mixpanel mp_processing_time_ms).
user_id VARCHAR
Your user id ($user_id; NULL for anonymous users).
device_id VARCHAR
Device / anonymous id ($device_id).
distinct_id VARCHAR
The id the tool resolves people by (Mixpanel distinct_id).
session_id VARCHAR
Session id as text ($session_id when the SDK sets one; Mixpanel computes sessions at query time).
insert_id VARCHAR
Client deduplication id ($insert_id).
properties JSON
Event properties (JSON object).
user_properties JSON
User properties at event time (Mixpanel export carries none: NULL).
platform VARCHAR
Platform, e.g. 'iOS', 'Android', 'Web' ($platform, else derived from mp_lib).
os VARCHAR
Operating system ($os).
country VARCHAR
Country code (mp_country_code).
city VARCHAR
City ($city).
app_version VARCHAR
App version ($app_version_string).
library VARCHAR
SDK that sent the event (mp_lib).
revenue DOUBLE
Revenue attached to the event (a numeric revenue / $revenue / $amount property).
Example

Active users per platform over three days

SELECT platform, count(DISTINCT distinct_id) AS users
FROM mixpanel.unified.events
WHERE event_time >= TIMESTAMPTZ '2026-11-01' AND event_time < TIMESTAMPTZ '2026-11-04'
GROUP BY platform
ORDER BY users DESC;
Link
property_definitions 1 example10 cols

Event and user property definitions in the shared product-analytics shape

Columns
toolnot null VARCHAR
The analytics tool the row came from: 'mixpanel'.
property_namenot null VARCHAR
Property key as sent with events or set on profiles.
scopenot null VARCHAR
'event' or 'user'.
event_name VARCHAR
Event the property belongs to (event scope; NULL for user properties).
data_type VARCHAR
JSON Schema type: string, number, integer, boolean, array or object.
description VARCHAR
Lexicon documentation of the property.
is_array BOOLEAN
Array-valued.
is_required BOOLEAN
Required.
is_hidden BOOLEAN
Hidden.
enum_values VARCHAR[]
Allowed values.
Example

Properties per scope

SELECT scope, count(*) AS properties
FROM mixpanel.unified.property_definitions
GROUP BY scope
ORDER BY scope;
Link
users 1 example12 cols

User profiles in the shared product-analytics shape

Columns
toolnot null VARCHAR
The analytics tool the row came from: 'mixpanel'.
user_idnot null VARCHAR
Your user id (Mixpanel: the profile distinct_id).
distinct_idnot null VARCHAR
The id Mixpanel resolves the person by (same as user_id here).
device_ids VARCHAR[]
Device ids of the person (not on Mixpanel profiles: NULL).
first_seen TIMESTAMP WITH TIME ZONE
When the profile was created ($created, read as UTC).
last_seen TIMESTAMP WITH TIME ZONE
When the user was last seen ($last_seen, read as UTC).
properties JSON
Every profile property as a JSON object.
platform VARCHAR
Platform (not on Mixpanel profiles: NULL).
os VARCHAR
Operating system last seen ($os).
country VARCHAR
ISO country code from geolocation ($country_code).
city VARCHAR
City from geolocation ($city).
app_version VARCHAR
App version last seen ($app_version_string).
ConstraintsPRIMARY KEY (distinct_id)
Example

Users per country

SELECT country, count(*) AS users
FROM mixpanel.unified.users
GROUP BY country
ORDER BY users DESC;
Link

Credentials

The secret type mixpanel declares, as reported by the worker itself.

mixpanel

How to get these credentials

Mixpanel service account (or project API secret), project id and data residency region

secret.sql
CREATE SECRET mixpanel (
    TYPE mixpanel,
    username     '<username>',
    secret       '<MIXPANEL_SECRET>',  -- secret
    project_id   '<project_id>',
    region       '<region>',
    api_secret   '<MIXPANEL_API_SECRET>',  -- secret
    workspace_id '<workspace_id>',
    base_url     '<base_url>'
);
Key Type Required Description
username VARCHAR — Service account username (Organization Settings > Service Accounts).
secret secret VARCHAR — Service account secret.
project_id VARCHAR — Numeric Mixpanel project id (Project Settings > Overview).
region VARCHAR — Data residency: 'us' (default), 'eu' or 'in'.
api_secret secret VARCHAR — Legacy project API secret, instead of a service account (still needs PROJECT_ID).
workspace_id VARCHAR — Optional workspace (data view) id for Query API calls.
base_url VARCHAR — Optional origin that replaces every Mixpanel host (a proxy or a local fixture server).

The worker doesn't mark which keys are required.

Create the secret in the same session, after attaching mixpanel — the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

events_columns — The events() result columns (binds only; attach a mixpanel secret and drop LIMIT 0 for rows)

SELECT event_name, event_time, distinct_id, os, properties
FROM mixpanel.main.events()
LIMIT 0;

Uses events

segmentation_columns — The segmentation() result columns (binds only; attach a mixpanel secret and drop LIMIT 0 for rows)

SELECT event, segment, period_start, value
FROM mixpanel.main.segmentation('Sign Up', '2026-11-01', '2026-11-03')
LIMIT 0;

Uses segmentation

Weekly conversion of each step of funnel 7509

SELECT step, event, count, round(overall_conv_ratio, 3) AS conversion
FROM mixpanel.main.funnel(7509, '2026-11-02', '2026-11-08', unit := 'week')
ORDER BY step

Uses funnel

Day-1 retention of each day's sign-ups

SELECT cohort_date, round(retention_rate, 3) AS day1
FROM mixpanel.main.retention('2026-11-01', '2026-11-03', born_event := 'Sign Up')
WHERE period = 1
ORDER BY cohort_date

Uses retention

Ten most common event names

SELECT event_name FROM mixpanel.main.event_names() ORDER BY rank LIMIT 10

Uses event_names

Properties of Purchase events by frequency

SELECT property_name, count
FROM mixpanel.main.top_event_properties('Purchase')
ORDER BY count DESC

Uses top_event_properties

17 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • How many 'Sign Up' events were there per operating system on 2026-11-02?
  • What was the total revenue from Purchase events between 2026-11-01 and 2026-11-03?
  • How many distinct users sent events from iOS during 2026-11-01 through 2026-11-03?
  • Using a segmentation report, how many Sign Up events happened each day from 2026-11-01 to 2026-11-03?
  • What is the overall conversion of the last step of the 'Signup funnel' for the week of 2026-11-02?
  • What share of users who signed up on 2026-11-01 came back one day later?

Mixpanel is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.