PostgreSQL Export

Last updated:

What does the PostgreSQL Export app do?

The PostgreSQL Export app enables you to export events from PostHog to a PostgreSQL instance on ingestion.

What are the requirements for this app?

Using the PostgreSQL Export app requires either PostHog Cloud, or a self-hosted PostHog instance running version 1.30.0 or later.

Not running 1.30.0? Find out how to update your self-hosted PostHog deployment!

You'll also need access to the PostgreSQL instance you want to export to.

How do I install the PostgreSQL Export app?

Firstly, make sure that PostHog can access your PostgreSQL instance. Wherever your instance is hosted, make sure it is set to accept incoming connections so that PostHog can connect to the database and insert events. If this is not possible in your case, consider using the S3 Export app and then setting up your own system for getting data into your Postgres instance.

You will also need to create a user with table creation privileges in your PostgreSQL instance, as well as a new table to store events and execute INSERT queries. You can and should block PostHog from doing anything else on any other tables. Giving PostHog table creation permissions should be enough to ensure this:

CREATE USER posthog WITH PASSWORD '123456yZ';
GRANT CREATE ON DATABASE your_database TO posthog;

Finally, follow the steps below.

  1. Visit the 'Apps' page in your instance of PostHog.
  2. Search for 'PostgreSQL' and select the app, press Install.
  3. Add the connection details at the plugin configuration step in PostHog.

Configuration

OptionDescription
Does your Postgres instance have a self-signed SSL certificate?
Type: choice
Required: False
In most cases, Heroku and RDS users should select 'Yes'.
PostgreSQL Database URL
Type: string
Required: False
You can use a URL containing host, port, username, and password, or fill in these fields individually below.
PostgreSQL instance host
Type: string
Required: False
Example: postgres.mydomain.com (Required if Database URL is not specified)
PostgreSQL instance port
Type: string
Required: False
Default: 5439 (Required if Database URL is not specified)
Database name
Type: string
Required: False
Required if Database URL is not specified
Table name
Type: string
Required: False
The plugin will create a table with this name to store the events in
Username available to the plugin for accessing your database instance
Type: string
Required: False
This user needs table creation access (Required if Database URL is not specified)
Password for the username specified above
Type: string
Required: False
Required if Database URL is not specified
Events to ignore
Type: string
Required: False
Comma separated list of events to ignore

Is the source code for this app available?

PostHog is open-source and so are all apps on the platform. The source code for the Postgres Export app is available on GitHub.

Who created this app?

We'd like to thank PostHog team members Yakko Majuri and community member Michael Shanks for creating the Postgres Export app. Thanks, both!

Who maintains this app?

This app is maintained by PostHog. If you have issues with the app not functioning as intended, please raise a bug report to let us know!

What if I have feedback on this app?

We love feature requests and feedback! Please create an issue to tell us what you think.

What if my question isn't answered above?

We love answering questions. Ask us anything via our Support page.

You can also join the PostHog Community Slack group to collaborate with others and get advice on developing your own PostHog apps.

Questions?

Was this page useful?

Next article

Redshift Export

What are the requirements for this app? Using the Redshift Export app requires either PostHog Cloud, or a self-hosted PostHog instance running version 1.30.0 or later. Not running 1.30.0? Find out how to update your self-hosted PostHog deployment ! You'll also need access to a Redshift Cluster to export to. How do I install the Redshift Export app? Create a Redshift Cluster Make sure PostHog can access your cluster This might require a few things: Allowing public access to the cluster…

Read next article