Visitar URL original
fix: Address review feedback on read_path validator · feast-dev/feast@fe6ce6c · GitHub
Skip to content

Commit fe6ce6c

Browse files
fix: Address review feedback on read_path validator
Drop the registry_type == "sql" condition from validate_read_path: SqlRegistryConfig is only ever used for SQL registries, so the check was redundant (and the now-unused ValidationInfo parameter and import go with it). Also fix the 'explicitely' typo in the normalization warning message. Signed-off-by: Larry Singleton <166439969+larrysingleton007@users.noreply.github.com>
1 parent 9397022 commit fe6ce6c

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎sdk/python/feast/infra/registry/sql.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77
from typing import Any, Callable, Dict, List, Optional, Union, cast
88

9-
from pydantic import StrictInt, StrictStr, ValidationInfo, field_validator
9+
from pydantic import StrictInt, StrictStr, field_validator
1010
from sqlalchemy import ( # type: ignore
1111
BigInteger,
1212
Column,
@@ -307,13 +307,11 @@ class SqlRegistryConfig(RegistryConfig):
307307
""" int: Number of worker threads to use for asynchronous caching in SQL Registry. If set to 0, it doesn't use ThreadPoolExecutor. """
308308

309309
@field_validator("read_path")
310-
def validate_read_path(
311-
cls, read_path: Optional[str], values: ValidationInfo
312-
) -> Optional[str]:
310+
def validate_read_path(cls, read_path: Optional[str]) -> Optional[str]:
313311
# Mirror `RegistryConfig.validate_path`: a bare `postgresql://` read_path
314312
# must be rewritten to the psycopg3 driver too, otherwise it silently
315313
# falls back to psycopg2 while `path` uses psycopg3.
316-
if read_path is not None and values.data.get("registry_type") == "sql":
314+
if read_path is not None:
317315
return cls._normalize_postgres_scheme(read_path, "read_path")
318316
return read_path
319317

‎sdk/python/feast/repo_config.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ def _normalize_postgres_scheme(value: str, field_name: str) -> str:
219219
f"The `{field_name}` of the `RegistryConfig` starts with a plain "
220220
"`postgresql` string. We are updating this to `postgresql+psycopg` "
221221
"to ensure that the `psycopg3` driver is used by `sqlalchemy`. If "
222-
f"you want to use `psycopg2` pass `postgresql+psycopg2` explicitely "
222+
f"you want to use `psycopg2` pass `postgresql+psycopg2` explicitly "
223223
f"to `{field_name}`. To silence this warning, pass `postgresql+psycopg` "
224-
f"explicitely to `{field_name}`."
224+
f"explicitly to `{field_name}`."
225225
)
226226
# Rewrite only the leading scheme, not any later occurrence (e.g.
227227
# inside credentials or a query string).

0 commit comments

Comments
 (0)