vector-io icon indicating copy to clipboard operation
vector-io copied to clipboard

PGVector impl

Open dhruv-anand-aintech opened this issue 1 year ago • 2 comments

fixes #54

dhruv-anand-aintech avatar May 21 '24 08:05 dhruv-anand-aintech

Your free trial has expired. To keep using Ellipsis, sign up at https://app.ellipsis.dev for $20/seat/month or reach us at [email protected]

ellipsis-dev[bot] avatar May 21 '24 08:05 ellipsis-dev[bot]

Sweep: PR Review

README.md

The changes in the README.md file involve reordering and updating the status of various vector databases in the "In Progress" and "Not Supported" sections.

Potential Issues

Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.

  • The removal of "Neo4j" and "Apache Solr" from the "Not Supported" section contradicts their addition in the same section, leading to potential confusion about their support status.
  • https://github.com/AI-Northstar-Tech/vector-io/blob/cb7e7ff5e35dcc09e1d09eed24ab1288be838365/README.md#L84-L88 View Diff


src/vdf_io/export_vdf/pgvector_export.py

The changes introduce the ExportPGVector class to handle exporting data from PGVector tables in a PostgreSQL database, including methods for argument parsing, data retrieval, and metadata generation.

Sweep Found These Issues

  • The get_all_schemas and get_all_table_names methods use self.conn.execute which is not a valid method for a psycopg2 connection object; it should be self.conn.cursor().execute.
  • https://github.com/AI-Northstar-Tech/vector-io/blob/cb7e7ff5e35dcc09e1d09eed24ab1288be838365/src%2Fvdf_io%2Fexport_vdf%2Fpgvector_export.py#L69-L81 View Diff


src/vdf_io/import_vdf/pgvector_import.py

Introduced a new class ImportPGVector for importing data into a PGVector database, including methods for database connection, schema and table retrieval, and data upsertion from Parquet files.

Sweep Found These Issues

  • The get_all_schemas and get_all_table_names methods use self.conn.execute which is not a valid method for a psycopg2 connection object; it should use a cursor object to execute SQL queries.
  • https://github.com/AI-Northstar-Tech/vector-io/blob/cb7e7ff5e35dcc09e1d09eed24ab1288be838365/src%2Fvdf_io%2Fimport_vdf%2Fpgvector_import.py#L77-L87 View Diff

  • The upsert_data method assumes that self.vdf_meta is already populated, but there is no code to load or initialize this attribute, which may lead to AttributeError.
  • https://github.com/AI-Northstar-Tech/vector-io/blob/cb7e7ff5e35dcc09e1d09eed24ab1288be838365/src%2Fvdf_io%2Fimport_vdf%2Fpgvector_import.py#L96-L99 View Diff

Potential Issues

Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.

  • The upsert_data method uses self.conn.create_table and self.conn.open_table which are not valid methods for a psycopg2 connection object; these should be replaced with appropriate SQL commands or ORM methods.
  • https://github.com/AI-Northstar-Tech/vector-io/blob/cb7e7ff5e35dcc09e1d09eed24ab1288be838365/src%2Fvdf_io%2Fimport_vdf%2Fpgvector_import.py#L120-L126 View Diff


src/vdf_io/names.py

A new class attribute PGVECTOR was added to the DBNames class to include the "pgvector" database.


src/vdf_io/notebooks/jsonl_to_parquet.ipynb

The changes include reordering the execution of code cells, updating the file path for loading data, modifying the DataFrame display headers and data, and adding new functionality to calculate DataFrame length, display a summary, add a new column, and save the DataFrame as a Parquet file.

Sweep Found These Issues

  • The change in the file path for the jsonl_file variable may introduce issues if the new file does not exist or is not accessible, leading to a FileNotFoundError or similar error.
  • https://github.com/AI-Northstar-Tech/vector-io/blob/cb7e7ff5e35dcc09e1d09eed24ab1288be838365/src%2Fvdf_io%2Fnotebooks%2Fjsonl_to_parquet.ipynb#L38 View Diff


src/vdf_io/pgvector_util.py

Introduced a new module pgvector_util.py with functions to create a command-line argument parser and prompt for Postgres connection details.

Sweep Found These Issues

  • The function set_pgv_args_from_prompt does not validate the connection string format, which could lead to runtime errors if an invalid connection string is provided.
  • https://github.com/AI-Northstar-Tech/vector-io/blob/cb7e7ff5e35dcc09e1d09eed24ab1288be838365/src%2Fvdf_io%2Fpgvector_util.py#L42-L47 View Diff

  • The default password "postgres" is set if the user does not provide one, which could be a security risk.
  • https://github.com/AI-Northstar-Tech/vector-io/blob/cb7e7ff5e35dcc09e1d09eed24ab1288be838365/src%2Fvdf_io%2Fpgvector_util.py#L61-L63 View Diff