File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1212 StrictInt ,
1313 StrictStr ,
1414 ValidationError ,
15+ ValidationInfo ,
1516 field_validator ,
1617 model_validator ,
1718)
@@ -128,6 +129,21 @@ class RegistryConfig(FeastBaseModel):
128129 sqlalchemy_config_kwargs : Dict [str , Any ] = {}
129130 """ Dict[str, Any]: Extra arguments to pass to SQLAlchemy.create_engine. """
130131
132+ @field_validator ("path" )
133+ def validate_path (cls , path : str , values : ValidationInfo ) -> str :
134+ if values .data .get ("registry_type" ) == "sql" :
135+ if path .startswith ("postgresql://" ):
136+ _logger .warning (
137+ "The `path` of the `RegistryConfig` starts with a plain "
138+ "`postgresql` string. We are updating this to `postgresql+psycopg` "
139+ "to ensure that the `psycopg3` driver is used by `sqlalchemy`. If "
140+ "you want to use `psycopg2` pass `postgresql+psycopg2` explicitely "
141+ "to `path`. To silence this warning, pass `postgresql+psycopg` "
142+ "explicitely to `path`."
143+ )
144+ return path .replace ("postgresql://" , "postgresql+psycopg://" )
145+ return path
146+
131147
132148class RepoConfig (FeastBaseModel ):
133149 """Repo config. Typically loaded from `feature_store.yaml`"""
You can’t perform that action at this time.
0 commit comments