Skip to content

sqlalchemy support: select on the right-hand side of <-> operator #147

@javaccar

Description

@javaccar

Here's an example from the pgvector docs

SELECT * FROM items WHERE id != 1 ORDER BY embedding <-> (SELECT embedding FROM items WHERE id = 1) LIMIT 5;

Notice how the right-hand side of the <-> is a select statement that should return only one value.

The pgvector-python sqlalchemy examples and test cases only ever seem to use a hardcoded embedding like [1, 1, 1] on the right-hand side.

Can it be made explicit in the documentation if a select like (SELECT embedding FROM items WHERE id = 1) can be used as an argument to the cosine_distance method, for example? If right-hand side can be a select, an example query would be helpful. If the right-hand side cannot be a select, I think that should be highlighted as a gap in the sqlalchemy support

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