> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL as a data source

> Bring data from PostgreSQL to Nekt.

PostgreSQL is a powerful open-source object-relational database system that extends the SQL language with advanced features. It's known for its reliability, data integrity, and support for complex queries, making it ideal for enterprise applications, data warehousing, and web services.

<img height="50" src="https://mintcdn.com/nekt/0tn1_nwKYqAHn7jo/assets/logo/logo-postgres.png?fit=max&auto=format&n=0tn1_nwKYqAHn7jo&q=85&s=350222c158a06767cba187b197ad1930" data-path="assets/logo/logo-postgres.png" />

## 0. Required pre work

In order to connect Nekt to a database, you have to do some pre work to ensure access is granted in a secure way. So, make sure to check [this guide](/sources/pre-work-db-connection) before proceeding.

## 1. Add your PostgreSQL access

1. Once you have done the pre work defined in section 0, you can inform your database accesses. In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the Postgres option from the list of connectors.

2. Click **Next** and you'll be prompted to add your database access.

3. Click **Next**.

## 2. Select your Postgres streams

1. The next step is letting us know which streams you want to bring. You can select entire groups of streams or only a subset of them.

   > Tip: The stream can be found more easily by typing its name.

2. Click **Next**.

## 3. Configure your Postgres data streams

1. Customize how you want your data to appear in your catalog. Select a name for each table (which will contain the fetched data) and the type of sync.

* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** and make this process faster!
* **Sync Type**: you can choose between INCREMENTAL, FULL TABLE and LOG BASED.
  * Incremental: every time the extraction happens, we'll get only the new data - which is good if, for example, you want to keep every record ever fetched and save some extraction time.
  * Full table: every time the extraction happens, we'll get the current state of the data - which is good if, for example, you don't want to have deleted data in your catalog.
  * Log based: to support log based syncs, you have to do a little pre work on your database. Check the procedure [here](/sources/postgres-log-based-sync#enable-log-based-sync-on-postgres-db).

2. Click **Next**.

## 4. Configure your Postgres data source

1. Describe your data source for easy identification within your organization. You can inform things like what data it brings, to which team it belongs, etc.

2. To define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times).

### Check your new source!

1. Click **Done** to finalize the setup. Once completed, you'll receive confirmation that your new source is set up!

2. You can view your new source on the [Sources](https://app.nekt.ai/sources) page. Now, for you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you have to wait for the pipeline to run. You can now monitor it on the [Sources](https://app.nekt.ai/sources) page to see its execution and completion. If needed, manually trigger the pipeline by clicking on the refresh icon. Once executed, your new table will appear in the Catalog section.

> If you encounter any issues, reach out to us via Slack, and we'll gladly assist you!

## Skills for agents

<Snippet file="agent-skills-intro.mdx" />

<Card title="Download PostgreSQL skills file" icon="wand-magic-sparkles" href="/sources/postgres.md">
  PostgreSQL connector documentation as plain markdown, for use in AI agent contexts.
</Card>
