-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Postgres supported as Registry, Online store, and Offline store #2401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ed18f7e
Feast-postgres added to Feast repo
nossrannug bc8a630
Add a template for postgres to allow feast init -t postgres
nossrannug 1a705e3
Split contrib repo configuration to separate file for each
nossrannug 643f911
Moved the postgres type maps into feast.type_map
nossrannug 15e71e7
Upgrade to latest feast, get postgres tests running, pip lock files
nossrannug 953c3e7
Fix setup.py
kevjumba 66c4699
Fix the ci requirements
kevjumba d0b5081
Fix repo_config for rest of sources
kevjumba c4de36e
Make backwards compatible with python 3.8-
kevjumba 979e326
Fix
kevjumba 199850e
Fix
kevjumba 885d789
address comments
adchia ad947a9
update lock files
adchia 1f246ad
fix
adchia f625910
lock files
adchia c6d93cd
fix
adchia e6c39ff
cleanup
adchia caad6c0
missed refactor name
adchia a0f9476
Remove snowflake references from test.py for postgres
nossrannug 7a792a5
update repo to match new API
adchia 8e1509d
Add documentation
adchia 8e6ec1e
rename utils
adchia 3522e23
update roadmap docs
adchia 72e9e3e
update documentation
adchia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.