Connecting to the warehouse

Contents

The warehouse is in beta

Need access first? Join the waitlist, then set up your warehouse.

The warehouse runs on PostHog's fork of Trino, which keeps Trino's standard client protocol. You connect with the same clients, drivers, and BI tools you'd point at any Trino cluster. No PostHog-specific SDK involved.

Connection details

Your connection details live in Data ops under the Settings tab once the warehouse is ready:

FieldValue
Host<your-warehouse-name>.dw.us.postwh.com (US) or <your-warehouse-name>.dw.eu.postwh.com (EU)
Port443
CatalogShown in the Settings tab, derived from your warehouse name – e.g. org_my_warehouse
Usernameroot
PasswordShown once at provisioning; reset it from the Settings tab if lost

Connections use HTTPS, so always connect with TLS. A complete connection with the Trino CLI looks like:

Terminal
trino --server https://my-warehouse.dw.us.postwh.com:443 --user root --password --catalog org_my_warehouse

The same details work in any Trino client: the JDBC driver, the Python client, and BI and SQL tools with a Trino connector, such as DBeaver, Superset, Metabase, and Tableau.

For example, in Python:

Python
from trino.dbapi import connect
from trino.auth import BasicAuthentication
conn = connect(
host="my-warehouse.dw.us.postwh.com",
port=443,
http_scheme="https",
user="root",
auth=BasicAuthentication("root", "<your-password>"),
catalog="org_my_warehouse",
)
cur = conn.cursor()
cur.execute("SELECT count(*) FROM posthog.events_prod")
print(cur.fetchone())

Find your way around

Your first stop after connecting should be discovering what's there:

SQL
-- List schemas and tables
SHOW SCHEMAS;
SHOW TABLES FROM posthog;
-- Inspect a table's columns
DESCRIBE posthog.events_prod;

With a project schema named prod, the layout looks like:

SQL
-- Your PostHog events, persons, and groups
SELECT count(*) FROM posthog.events_prod;
-- Imported source tables live in a per-project imports schema
SHOW TABLES FROM posthog_data_imports_prod;

What SQL works

The warehouse speaks Trino's SQL dialect, which follows ANSI SQL: SELECT, joins, CTEs, window functions, UNNEST, and the full function library, including JSON functions, lambda expressions, and approximate aggregates like approx_distinct and approx_percentile.

You can also write: CREATE TABLE, CREATE TABLE AS, CREATE VIEW, INSERT, UPDATE, DELETE, and MERGE are supported, so the warehouse can hold your own derived tables next to the synced data. Keep your own work in tables or schemas you create – the PostHog-managed tables are maintained by sync, and anything you write into them can be overwritten.

Credentials are managed by PostHog, so CREATE ROLE and GRANT aren't available.

Querying from PostHog

You don't need an external client to use the warehouse. In PostHog's SQL editor, pick PostHog (Trino) from the connection menu to run a query on the warehouse. PostHog translates your SQL for the warehouse and runs it read-only. Most queries work unchanged. A few ClickHouse-specific features, such as SAMPLE, FINAL, and WITH FILL, aren't available, and the editor tells you when a query uses one.

External connections are for everything else – dashboards in your BI tool, notebooks, scheduled jobs, writes, or ad-hoc CLI sessions.

Outbound IP addresses

When the warehouse connects to a database or service you run, such as a Postgres database you query from the warehouse, those connections come from a fixed set of IP addresses for your region. If your database only accepts connections from known addresses, add the range for your region to its firewall or security group:

RegionIP range
US3.41.210.208/28
EU3.40.8.64/28

These ranges are shared by every organization's warehouse in that region, so allowlisting them isn't a substitute for authentication. Keep requiring credentials and TLS on anything you expose to them.

For larger workloads, read about how the warehouse handles performance and limits.

Still have questions?

Was this page useful?