-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Postgres supported as Registry, Online store, and Offline store (…
…#2401) * Feast-postgres added to Feast repo Signed-off-by: Gunnar Sv Sigurbjörnsson <[email protected]> * Add a template for postgres to allow feast init -t postgres Signed-off-by: Gunnar Sv Sigurbjörnsson <[email protected]> * Split contrib repo configuration to separate file for each Signed-off-by: Gunnar Sv Sigurbjörnsson <[email protected]> * Moved the postgres type maps into feast.type_map Signed-off-by: Gunnar Sv Sigurbjörnsson <[email protected]> * Upgrade to latest feast, get postgres tests running, pip lock files Signed-off-by: Gunnar Sv Sigurbjörnsson <[email protected]> * Fix setup.py Signed-off-by: Kevin Zhang <[email protected]> * Fix the ci requirements Signed-off-by: Kevin Zhang <[email protected]> * Fix repo_config for rest of sources Signed-off-by: Kevin Zhang <[email protected]> * Make backwards compatible with python 3.8- Signed-off-by: Kevin Zhang <[email protected]> * Fix Signed-off-by: Kevin Zhang <[email protected]> * Fix Signed-off-by: Kevin Zhang <[email protected]> * address comments Signed-off-by: Danny Chiao <[email protected]> * update lock files Signed-off-by: Danny Chiao <[email protected]> * fix Signed-off-by: Danny Chiao <[email protected]> * lock files Signed-off-by: Danny Chiao <[email protected]> * fix Signed-off-by: Danny Chiao <[email protected]> * cleanup Signed-off-by: Danny Chiao <[email protected]> * missed refactor name Signed-off-by: Danny Chiao <[email protected]> * Remove snowflake references from test.py for postgres Signed-off-by: Gunnar Sv Sigurbjörnsson <[email protected]> * update repo to match new API Signed-off-by: Danny Chiao <[email protected]> * Add documentation Signed-off-by: Danny Chiao <[email protected]> * rename utils Signed-off-by: Danny Chiao <[email protected]> * update roadmap docs Signed-off-by: Danny Chiao <[email protected]> * update documentation Signed-off-by: Danny Chiao <[email protected]> Co-authored-by: Kevin Zhang <[email protected]> Co-authored-by: Kevin Zhang <[email protected]> Co-authored-by: Danny Chiao <[email protected]>
- Loading branch information
1 parent
d66c931
commit ed2f979
Showing
49 changed files
with
2,010 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# PostgreSQL | ||
|
||
## Description | ||
|
||
**NOTE**: The Postgres plugin is a contrib plugin. This means it may not be fully stable. | ||
|
||
|
||
The PostgreSQL data source allows for the retrieval of historical feature values from a PostgreSQL database for building training datasets as well as materializing features into an online store. | ||
|
||
## Examples | ||
|
||
Defining a Postgres source | ||
|
||
```python | ||
from feast.infra.offline_stores.contrib.postgres_offline_store.postgres_source import ( | ||
PostgreSQLSource, | ||
) | ||
|
||
driver_stats_source = PostgreSQLSource( | ||
name="feast_driver_hourly_stats", | ||
query="SELECT * FROM feast_driver_hourly_stats", | ||
timestamp_field="event_timestamp", | ||
created_timestamp_column="created", | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Spark | ||
# Spark (contrib) | ||
|
||
## Description | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# PostgreSQL (contrib) | ||
|
||
## Description | ||
|
||
The PostgreSQL offline store is an offline store that provides support for reading [PostgreSQL](../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 `SparkRetrievalJob` 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. | ||
|
||
## 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 | ||
online_store: | ||
path: data/online_store.db | ||
``` | ||
{% endcode %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Spark | ||
# Spark (contrib) | ||
|
||
## Description | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# PostgreSQL (contrib) | ||
|
||
## Description | ||
|
||
The PostgreSQL online store provides support for materializing feature values into a PostgreSQL database for serving online features. | ||
|
||
* Only the latest feature values are persisted | ||
|
||
## Example | ||
|
||
{% code title="feature_store.yaml" %} | ||
```yaml | ||
project: my_feature_repo | ||
registry: data/registry.db | ||
provider: local | ||
online_store: | ||
type: postgres | ||
host: DB_HOST | ||
port: DB_PORT | ||
database: DB_NAME | ||
db_schema: DB_SCHEMA | ||
user: DB_USERNAME | ||
password: DB_PASSWORD | ||
``` | ||
{% endcode %} | ||
Configuration options are available [here](https://rtd.feast.dev/en/latest/#feast.repo_config.SqliteOnlineStoreConfig). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ython/docs/source/feast.infra.offline_stores.contrib.postgres_offline_store.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
feast.infra.offline\_stores.contrib.postgres\_offline\_store package | ||
==================================================================== | ||
|
||
Submodules | ||
---------- | ||
|
||
feast.infra.offline\_stores.contrib.postgres\_offline\_store.postgres module | ||
---------------------------------------------------------------------------- | ||
|
||
.. automodule:: feast.infra.offline_stores.contrib.postgres_offline_store.postgres | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
feast.infra.offline\_stores.contrib.postgres\_offline\_store.postgres\_source module | ||
------------------------------------------------------------------------------------ | ||
|
||
.. automodule:: feast.infra.offline_stores.contrib.postgres_offline_store.postgres_source | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: feast.infra.offline_stores.contrib.postgres_offline_store | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
sdk/python/docs/source/feast.infra.online_stores.contrib.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
feast.infra.online\_stores.contrib package | ||
========================================== | ||
|
||
Submodules | ||
---------- | ||
|
||
feast.infra.online\_stores.contrib.postgres module | ||
-------------------------------------------------- | ||
|
||
.. automodule:: feast.infra.online_stores.contrib.postgres | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: feast.infra.online_stores.contrib | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
feast.infra.utils.postgres package | ||
================================== | ||
|
||
Submodules | ||
---------- | ||
|
||
feast.infra.utils.postgres.connection\_utils module | ||
--------------------------------------------------- | ||
|
||
.. automodule:: feast.infra.utils.postgres.connection_utils | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
feast.infra.utils.postgres.postgres\_config module | ||
-------------------------------------------------- | ||
|
||
.. automodule:: feast.infra.utils.postgres.postgres_config | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: feast.infra.utils.postgres | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.