# Ingesting data into Cognite RAW
Cognite RAW does not have a predefined database or table setup, so you need to create the database table in CDF and a foreign table for the PostgreSQL gateway before setting up the connection in your ETL tool.
In this article:
# Step 1: Create Cognite RAW database table
Sign in to Cognite Data Fusion (opens new window) as an admin.
In the top menu, select Integrate > Browse staged data.
Under Databases, click Create Database and enter a Unique name.
Under Databases, click Create Table and enter a Unique name.
# Step 2: Connect to PostgreSQL gateway
Connect to the PostgreSQL gateway using a standard PostgreSQL server tool. The example below uses pgAdmin.
Click Add New Server and enter a name on the General tab.
On the Connection tab,
In the Host name/address field, enter
clusteris where your CDF instance is installed.
In the Maintenance database and Username fields, enter the username returned by the PostgreSQL gateway when you generated the user credentials.
In the Password field, enter the password returned by the PostgreSQL gateway when you generated the user credentials.
Click Save to connect to the PostgreSQL gateway server.
# Step 3: Create foreign table for RAW table in PostgreSQL gateway
Under Servers, open the PostgreSQL gateway server.
Under Schemas, select Foreign Tables, then right-click and select Create > Foreign Table.
In the Create-Foreign table window:
On the General tab, enter a Name.
On the Definitions tab, select raw_server in the Foreign server list.
On the Columns tab, click the plus sign to create the database table columns you want to ingest data into.
On the Options tab:
In the Option field, enter primary_key (in small letters only) in the first row.
In the Value field, select one of the columns you created in step 3. The values in this column must be unique and not contain nulls.
In the Option field, enter database in the second row.
In the Value field, enter the database name exactly as given in the database you created in CDF RAW.
In the Option field, enter table in the third row.
In the Value field, enter a table name exactly as given in the table you created in CDF RAW.
Click Save and verify that the table you created is listed under Foreign Tables in the sidebar of the PostgreSQL server.
# Step 4: Complete the connection in ETL
- Verify that the table you created above is available as a foreign table in your ETL tool and configure your ETL pipeline between the source system and Cognite RAW.