---
name: redash-schema
description: Knowledge base of Humand tables and SQL patterns, organized by data source. Use when you need column details, table relationships, reusable CTEs, or to know which tables to use for a specific case. Complements redash-connect (which has core tables).
disable-model-invocation: true
---

# Redash Schema

Table details by data source. Core tables (Users, Instances, InstanceCrmData, FeatureFlags, CommunityFeatures) are in the `redash-connect` skill.

## How to use

1. Identify which data source you need (see table in `redash-connect`)
2. Read the corresponding reference file below
3. If you need CTEs or SQL patterns, read `sql-patterns.md`

## Reference files

### DS 1 — Humand Prod | Read replica

Specialized monolith tables: segmentations, sessions, jobs, audit, capabilities.

**Read**: [reference/ds-1-humand-prod.md](reference/ds-1-humand-prod.md)

Tables covered:
- **Segmentations**: SegmentationGroups, SegmentationItems, Segmentations, UserSegmentationItems, SegmentationHistories
- **Sessions**: active sessions, refresh/access tokens
- **Jobs**: bulk uploads, import performance
- **AuditLogs / Audits**: what IS logged and what is NOT
- **Capabilities / UserCapabilities**: legacy permissions model (pre-Cerberus)

### DS 13 — Insights

Security events + Amplitude data.

**Read**: [reference/ds-13-insights.md](reference/ds-13-insights.md)

Tables covered:
- **api_events**: backend security events (18 event_types)
- **Amplitude**: monthly tables `amplitude_events_YYYY_MM`, pre-calculated table `daily_active_users`
- **Specific tables**: ai_chatbot_*, knowledge_library_events, feed_post_events, group_post_events

### DS 25 — Cerberus

Roles and permissions (new model).

**Read**: [reference/ds-25-cerberus.md](reference/ds-25-cerberus.md)

Tables covered:
- **roles**: role definitions per instance
- **role_permissions**: permissions assigned to each role
- **user_roles**: user-role assignment
- **permissions**: available permissions catalog

### Reusable SQL patterns

Battle-tested CTEs for dashboards and analysis.

**Read**: [reference/sql-patterns.md](reference/sql-patterns.md)

Patterns:
- CTE `instancias_reales` (filter out test/internal instances)
- Weekly trend
- New client cohort
- Segmentation history
