Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention that vec0 tables cannot be renamed #125

Open
emschwartz opened this issue Oct 16, 2024 · 2 comments
Open

Mention that vec0 tables cannot be renamed #125

emschwartz opened this issue Oct 16, 2024 · 2 comments

Comments

@emschwartz
Copy link

This might be obvious to others but it might be worth mentioning in the docs that vec0 tables cannot be renamed.

I was trying to migrate an existing table to use sqlite-vec with the following migration script:

CREATE VIRTUAL TABLE new_item_embeddings USING vec0(
    embedding FLOAT[1024]
);

INSERT INTO new_item_embeddings (rowid, embedding)
SELECT id, embedding FROM item_embeddings;

DROP TABLE item_embeddings;

ALTER TABLE new_item_embeddings RENAME TO item_embeddings;

However, trying to select or insert using that renamed table fails with an error like: Internal sqlite-vec error: could not initialize 'rowids get chunk position' statement.

This migration script works:

ALTER TABLE item_embeddings RENAME TO old_item_embeddings;

CREATE VIRTUAL TABLE item_embeddings USING vec0(
    embedding FLOAT[1024]
);

INSERT INTO item_embeddings (rowid, embedding)
SELECT id, embedding FROM old_item_embeddings;

DROP TABLE old_item_embeddings;
@asg017
Copy link
Owner

asg017 commented Oct 16, 2024

This will be fixed in #43! I'll try to get it in the latest release

@emschwartz
Copy link
Author

Ah, nice! Didn't see that PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants