PluginsAmplitude
Amplitude Database Schema
Database entities and querying synced Amplitude data
The Amplitude plugin syncs analytics data to your database for fast queries.
New to Corsair? Learn about database operations, data synchronization, and multi-tenancy.
Full Implementation: See the Amplitude plugin source code.
Synced Entities
- events - Event type definitions
- users - User profiles and properties
- cohorts - Cohort definitions
Database API
const events = await corsair.amplitude.db.events.search({
data: { event_type: "page_view" },
});Events
Schema
{
event_type: string; // Event name
category?: string; // Event category
description?: string; // Event description
totals?: number; // Total occurrences
totals_delta?: number; // Change from previous period
hidden?: boolean; // Whether hidden in dashboard
}Querying Events
Search by event type:
const events = await corsair.amplitude.db.events.search({
data: { event_type: "purchase" },
});Users
Schema
{
user_id: string;
device_id?: string;
country?: string;
city?: string;
region?: string;
language?: string;
platform?: string;
os?: string;
version_name?: string;
user_properties?: Record<string, unknown>;
last_seen?: string; // ISO timestamp
}Querying Users
const users = await corsair.amplitude.db.users.search({
data: { country: "US" },
});Cohorts
Schema
{
id: string;
name: string;
description?: string;
size: number;
type: string; // static | dynamic
created_at: string; // ISO timestamp
last_computed?: string; // ISO timestamp
hidden?: boolean;
}Example: Multi-Tenancy Query
const tenant = corsair.withTenant("org-123");
const cohorts = await tenant.amplitude.db.cohorts.search({
data: { type: "dynamic" },
});