You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pre-create the SQL registry schema so the application does not need DDL privileges at runtime. Use this with `schema_mode: verify` or `schema_mode: skip` in your `feature_store.yaml`.
492
+
493
+
```text
494
+
feast registry create-schema
495
+
```
496
+
497
+
This command only applies to SQL-based registries (`registry_type: sql`). It is safe to run multiple times — existing tables are not modified.
Copy file name to clipboardExpand all lines: docs/reference/registries/sql.md
+29-2Lines changed: 29 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,9 +80,36 @@ docker build \
80
80
If you are running Feast in Kubernetes, set the `image.repository` and
81
81
`imagePullSecrets`Helm values accordingly to utilize your custom image.
82
82
83
+
## Schema management (`schema_mode`)
84
+
85
+
By default, the SQL registry creates its tables on every startup (`schema_mode: auto`). In production environments where the application should not have DDL privileges, you can pre-create the schema and configure the registry to only verify it:
86
+
87
+
```yaml
88
+
registry:
89
+
registry_type: sql
90
+
path: postgresql://db:5432/feast
91
+
schema_mode: verify # or "skip"
92
+
```
93
+
94
+
| Value | Behavior |
95
+
|---|---|
96
+
| `auto` (default) | Creates tables if they don't exist. Current behavior, no breaking change. |
97
+
| `verify` | Skips DDL. Checks that all expected tables exist on startup; raises an error listing missing tables if any are absent. When a separate `read_path` is configured, the read replica is also verified — a lagging replica (e.g. mid-migration) will block startup. Note: this is a table-level check only — it does not verify individual columns. A schema created by an older Feast version (missing newer columns) will pass verification but may fail at query time. |
98
+
| `skip` | Skips both creation and verification. Use when schema is managed entirely outside Feast (e.g. by a migration tool). |
99
+
100
+
### Pre-creating the schema
101
+
102
+
When using `verify` or `skip` mode, run the following CLI command with a user that has DDL privileges to create the schema before starting the application:
103
+
104
+
```shell
105
+
feast registry create-schema
106
+
```
107
+
108
+
This reads `feature_store.yaml`, connects to the configured database, and creates all required tables. It is safe to run multiple times — existing tables are not modified.
109
+
83
110
There are some things to note about how the SQL registry works:
84
-
- Once instantiated, the Registry ensures the tables needed to store data exist, and creates them if they do not.
85
-
- Upon tearing down the feast project, the registry ensures that the tables are dropped from the database.
111
+
- When `schema_mode` is `auto` (the default), the Registry ensures the tables needed to store data exist, and creates them if they do not.
112
+
- Upon tearing down the feast project, the registry deletes all rows from the registry tables (it does not drop the tables themselves). This runs regardless of `schema_mode` and requires only DML (`DELETE`) privileges, not DDL.
86
113
- The schema for how data is laid out in tables can be found in the table definitions in [`sdk/python/feast/infra/registry/sql.py`](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/infra/registry/sql.py). It is intentionally simple, storing the serialized protobuf versions of each Feast object keyed by its name.
0 commit comments