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

# Postgres Connector

> Retrieve data from PostgreSQL

Connect to an existing PostgreSQL instance and extract data. Rows of data in PostgreSQL are extracted as JSON objects.

<Note>Supports common implementations of PostgreSQL including Supabase </Note>

## Properties

Required properties:

* `connection_string`: Connection string to the Postgres instance
* `query`: SQL query to extract data (i.e. Select \* From TableName)

Optional properties:

* `batch_size`: The size of batches of rows. Affects performance and latency.

Compatible loaders:

* NeumJSONLoader

## Usage

<CodeGroup>
  ```python Local Development
  from neumai.DataConnectors import PostgresConnector
  from neumai.Shared import Selector

  postgres_connector =  PostgresConnector(
      connection_string = "postgresql://postgres:<password>@<host>:<port>/postgres",
      query = """ Select * From "TableName"; """
  )
  ```

  ```json Cloud
  {
      "sources":[
          {
              "data_connector": {
                  "connector_name":"PostgresConnector",
                  "connector_information":{
                      "connection_string":"<INSERT POSTGRES CONNECTION STRING>",
                      "query":"Select * From TableName"
                  },
              }
          }
      ]
  }
  ```
</CodeGroup>
