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

String ID support #9

Merged
merged 3 commits into from
Jan 15, 2024
Merged

String ID support #9

merged 3 commits into from
Jan 15, 2024

Conversation

xthexder
Copy link
Contributor

String ID support shipped today on the turbopuffer backend. This adds support for string IDs such as UUIDs.

@@ -31,7 +31,7 @@ def __str__(self) -> str:
return f'tpuf-namespace:{self.name}'

@overload
def upsert(self, ids: List[int], vectors: List[List[float]], attributes: Optional[Dict[str, List[Optional[str]]]] = None) -> None:
def upsert(self, ids: Union[List[int], List[str]], vectors: List[List[float]], attributes: Optional[Dict[str, List[Optional[str]]]] = None) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how the column oriented API makes it clear the IDs need to all be the same type

Copy link
Contributor Author

@xthexder xthexder Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that was a conscious decision to use over List[Union[int, str]]. The code doesn't enforce these annotations, but some user's linters might.

@xthexder xthexder merged commit 02e3c94 into main Jan 15, 2024
5 checks passed
@xthexder xthexder deleted the string_id_support branch January 15, 2024 22:04
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

Successfully merging this pull request may close these issues.

2 participants