Skip to content

SQL registry read_path is not normalized to the psycopg3 driver like path #6643

Description

@larrysingleton007

Description

For a SQL registry, RegistryConfig.validate_path rewrites a bare postgresql:// URL in path to postgresql+psycopg:// so SQLAlchemy uses the psycopg3 driver, and logs a warning explaining the rewrite. read_path gets no equivalent treatment. It has no validator, so a bare postgresql:// read_path reaches create_engine unchanged and SQLAlchemy falls back to the psycopg2 driver, diverging from path (which used psycopg3) with no warning.

If psycopg2 isn't installed, or a project has standardized on psycopg3, this fails at connection time with nothing pointing at read_path as the odd one out.

Reproduction

from feast.infra.registry.sql import SqlRegistryConfig

config = SqlRegistryConfig(
    path="postgresql://user@host/db",
    read_path="postgresql://user@host/replica",
)
print(config.path)       # postgresql+psycopg://user@host/db   (rewritten + warned)
print(config.read_path)  # postgresql://user@host/replica      (untouched, no warning)

Expected

read_path should normalize the same way path does: rewrite a leading postgresql:// to postgresql+psycopg:// and log the same migration warning. An explicit postgresql+psycopg2:// should be left as-is, matching the existing path behavior.

Details

validate_path is a @field_validator("path") on RegistryConfig in sdk/python/feast/repo_config.py, gated on registry_type == "sql". read_path is declared on SqlRegistryConfig in sdk/python/feast/infra/registry/sql.py; it inherits the path validator but has none of its own, so it flows straight into create_engine(registry_config.read_path, ...).

Affects 0.64.0 and current master. A PR follows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions