Learn more about PostgreSQL Import Integration.

You can export job results from Treasure Data to your existing PostgreSQL instance.

For sample workflows of PostgreSQL, view Treasure Boxes.

Continue to the following topics:


Use the TD Console to Create Your Connection

Create a New Connection

Complete the field values to create a new connection.

Enter the required credentials for your new PostgreSQL connection. Set the following parameters:

Configure Results Export to Your PostgreSQL Instance

Export from Treasure Data uses queries. You create or reuse a query. In the query, you configure the data connection.


Set the Export Result Parameters

Database name: The name of the database you are transferring data to. (Ex. your_database_name)

Table: The table to which you would like to export the data.

Output mode. Different methods to upload the data.

Insert Method. This option controls how the data is written into the Postgres table. The default method is copy; it is also the recommended method for most situations.

Schema: Defines the schema where the target table is located. If not specified, the default schema is to be used. The default schema depends on the user’s “search_path” setting but it is usually “public”.

Foreign Data Wrapper: This option controls whether or not a data wrapper is used to store the data. The default is none and should work in most instances.

Run Query and Check Results

Run the query with Output Results selected. If the query completes successfully, you see the results in the PostgreSQL database and table that you specified when entering the transfer details.

Optional: Use of Scheduled Jobs for Output

You can use Scheduled Jobs with Result Output, to periodically write the output result to a PostgreSQL instance that you specify.

Optional: Configure Export Results in Workflow

Within Treasure Workflow, you can specify the use of this data connector to output data.

timezone: UTC

    database: sample_datasets

  td>: queries/sample.sql
  result_connection: your_connections_name
   database: database_name
   table: table_name
   mode: append
   set_role:new role

Read about using data connectors in a workflow to export data. See an example workflow.