Use the PgVectorIngestOperator to store vector embeddings along with other data column values into a PostgreSQL table supporting vectors.

Using the Operator

The PgVectorIngestOperator accepts a SQL query that can be used to insert data along with vector embeddings column data in a Postgres database table that has the vector extension.

Make sure that the pgvector extension is installed on your Postgres database. See for installation instructions.

An example using the operator to ingest data is shown below:


    pgvector_ingest = PgVectorIngestOperator(
        sql=f"INSERT INTO {TABLE_NAME} (name, value, vector_column) "
        f"VALUES ('John Doe', 123, '[1.0, 2.0, 3.0]')",

Was this entry helpful?