# PostgreSQL (contrib)

## Description

The PostgreSQL offline store is an offline store that provides support for reading [PostgreSQL](/v0.22-branch/reference/data-sources/postgres.md) data sources.

**DISCLAIMER**: This PostgreSQL offline store still does not achieve full test coverage.

* Entity dataframes can be provided as a SQL query or can be provided as a Pandas dataframe. Pandas dataframes will be converted to a Spark dataframe and processed as a temporary view.
* A `PostgreSQLRetrievalJob` is returned when calling `get_historical_features()`.
  * This allows you to call
    * `to_df` to retrieve the pandas dataframe.
    * `to_arrow` to retrieve the dataframe as a PyArrow table.
    * `to_sql` to get the SQL query used to pull the features.
* sslmode, sslkey\_path, sslcert\_path, and sslrootcert\_path are optional

## Example

{% code title="feature\_store.yaml" %}

```yaml
project: my_project
registry: data/registry.db
provider: local
offline_store:
  type: postgres
  host: DB_HOST
  port: DB_PORT
  database: DB_NAME
  db_schema: DB_SCHEMA
  user: DB_USERNAME
  password: DB_PASSWORD
  sslmode: verify-ca
  sslkey_path: /path/to/client-key.pem
  sslcert_path: /path/to/client-cert.pem
  sslrootcert_path: /path/to/server-ca.pem
online_store:
    path: data/online_store.db
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.feast.dev/v0.22-branch/reference/offline-stores/postgres.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
