Open dhruv-anand-aintech opened 6 months ago
a4abad1443
)[!TIP] I can email you next time I complete a pull request if you set up your email here!
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
src/vdf_io/import_vdf/lancedb_import.py
✓ https://github.com/AI-Northstar-Tech/vector-io/commit/f168003cd3994a1082afd1126b665682b0d852f8 Edit
Modify src/vdf_io/import_vdf/lancedb_import.py with contents: Import the LanceDB `create_index` method at the top of the file:
from lancedb import create_index
src/vdf_io/import_vdf/lancedb_import.py
✓ https://github.com/AI-Northstar-Tech/vector-io/commit/f168003cd3994a1082afd1126b665682b0d852f8 Edit
Modify src/vdf_io/import_vdf/lancedb_import.py with contents: In the `upsert_data` method of the `ImportLanceDB` class, after the code block that creates a new table or opens an existing one, add the following to create an index on the table:
# Get the ID column from the parquet file schema
parquet_schema = pq.read_schema(parquet_files[0])
id_column = "id" # Default
for field in parquet_schema:
if field.name == ID_COLUMN:
id_column = field.name
break
# Create index on the table
create_index(table, id_column)
tqdm.write(f"Created index on {id_column} for table {new_index_name}")
This code reads the schema of the first parquet file to determine the name of the ID column (defaulting to "id" if not found). It then calls create_index
passing the table object and ID column name to create an index on that column.
I have finished reviewing the code for completeness. I did not find errors for sweep/create_lancedb_index_after_table_is_crea
.
💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.
This is an automated message generated by Sweep AI.
Checklist
- [X] Modify `src/vdf_io/import_vdf/lancedb_import.py` ✓ https://github.com/AI-Northstar-Tech/vector-io/commit/f168003cd3994a1082afd1126b665682b0d852f8 [Edit](https://github.com/AI-Northstar-Tech/vector-io/edit/sweep/create_lancedb_index_after_table_is_crea/src/vdf_io/import_vdf/lancedb_import.py) - [X] Modify `src/vdf_io/import_vdf/lancedb_import.py` ✓ https://github.com/AI-Northstar-Tech/vector-io/commit/f168003cd3994a1082afd1126b665682b0d852f8 [Edit](https://github.com/AI-Northstar-Tech/vector-io/edit/sweep/create_lancedb_index_after_table_is_crea/src/vdf_io/import_vdf/lancedb_import.py)