querying-production-databases
БесплатноБез исполняемых скриптовНе проверенDefault path for read-only queries against PostHog's production ClickHouse and Postgres in the US and EU regions. Uses the direct-connect SQL sources in the…
от PostHog★ 41 278 звёзд на GitHubОб этом скилле
Querying production databases
PostHog runs two separate instances: US and EU.
Each one has an internal project that holds direct-connect SQL sources: read-only, live connections to that region's production ClickHouse and Postgres.
execute-sql with a connectionId sends a query to one of these sources and returns the rows.
Staff work from one place, US team 2, through the PostHog MCP:
- US sources are in team 2, so the MCP queries them directly.
- EU sources are in the EU instance, which a US login cannot reach.
A personal PostHog connection links your EU login to US team 2.
posthog-connection-callthen runs the same tools in the EU project, as your EU user.
flowchart LR
agent{{Agent}} --> mcp[PostHog MCP<br/>US team 2]
mcp -->|execute-sql + connectionId| us[(US direct-connect sources<br/>ClickHouse, Postgres)]
mcp -->|posthog-connection-call| eu[EU internal project<br/>as your EU login]
eu -->|execute-sql + connectionId| eus[(EU direct-connect sources<br/>ClickHouse, Postgres)]
classDef phBlue fill:#1d4aff,stroke:#1d4aff,color:#fff;
classDef phGray fill:#e5e7eb,stroke:#c7ccd1,color:#000;
class agent,mcp,eu phBlue;
class us,eus phGray;
One-time setup
1. Point the MCP at US team 2
Authenticate the PostHog MCP against US cloud.
If the session starts in another project, run switch-project to team 2.
2. Connect your EU login to US team 2
Do this in the US app, while team 2 is the current project. The connection belongs to the project you are in when you create it.
- Open Account settings → Personal integrations → PostHog project (
/settings/user-personal-integrations). The section needs thePOSTHOG_CONNECTfeature flag. - Click Connect a PostHog project.
- Set the region to European Union (EU).
- Select only these scopes:
queryread,external_data_sourceread anduserread. Do not pick a preset.userread lets the connection read your EU user, which is how it finds the EU project. - In a separate tab, open
eu.posthog.comand switch your current project to the EU internal project that holds the direct-connect sources. The connection reads your current EU project to find its name and organization. If your current EU project is a different one, such as a demo project,targetcan fail to read the project you pick in step 6. - Click Connect EU, sign in with your EU login, and choose only that EU internal project on the consent screen. The connection can use only the projects you pick there.
Keep the scopes narrow.
A call through a connection must carry every scope the connection was granted, and an MCP session token holds only part of the read scopes.
A "Read-only (everything)" or "Full access" connection fails every call with Your API key must carry the scopes this connection was granted.
3. Find your connection id
call integrations-list {"kind": "posthog"}
A connection works only for the person who created it. Each staff member makes their own.
connection_id takes the id from this list as a number or a string.
4. Check where the connection runs
call posthog-connection-call {"connection_id": "<your connection id>", "tool": "external-data-sources-connections-list", "arguments": {}}
Every result has a ran_in block with the project, organization and region.
Make sure ran_in.project_name is the EU internal project.
An empty source list with a different ran_in project means the connection points at the wrong project: delete it and do step 2 again.
Querying
Find the direct-connect source
US:
call external-data-sources-connections-list {}
EU, through your connection:
call posthog-connection-call {"connection_id": "<your connection id>", "tool": "external-data-sources-connections-list", "arguments": {}}
Pick a source by prefix, source_type and description. Never reuse a remembered id.
In US team 2 the production sources are:
| Prefix | Engine | access_method |
Use for |
|---|---|---|---|
Production |
ClickHouse | direct |
data tier: posthog.* (events, person, query_log_archive, models.posthog_team) |
ClickHouse Prod US OPs |
ClickHouse | direct |
ops node: system.* (query_log, parts, mutations, merges, replication_queue, processes) |
(no prefix), description US prod |
Postgres | warehouse, live queries on |
the app database (public.posthog_* and product tables) |
The EU project has its own sources and names.
Установить querying-production-databases в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл querying-production-databases?
Default path for read-only queries against PostHog's production ClickHouse and Postgres in the US and EU regions. Uses the direct-connect SQL sources in the internal projects, through the PostHog MCP on US team 2. US sources run with `execute-sql` and a `connectionId`. EU sources run through a personal PostHog connection from US team 2 to an EU login, with `posthog-connection-call`. Covers the one-time EU connection setup, finding the sources, raw ClickHouse vs HogQL modes, and query patterns for `query_log_archive`, `system.*`, per-team events, and app tables. Use it before the Metabase skill, which is the fallback for Postgres query plans, the test cluster, and shareable links. Internal-only: results contain cross-customer data.
Как установить скилл querying-production-databases?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл querying-production-databases запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic