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

Add copy_from_namespace parameter + test #56

Merged
merged 3 commits into from
Feb 20, 2025
Merged

Conversation

morgangallant
Copy link
Contributor

Original iteration I edited the upsert function, but since copy_from_namespace doesn't accept documents or schema changes, it doesn't really make sense to have it be the same function. I think it's better to have it be its own function so that the invalid input is inexpressible

Signed-off-by: Morgan Gallant <[email protected]>
Signed-off-by: Morgan Gallant <[email protected]>
@@ -185,6 +185,19 @@ def update_schema(self, schema_updates: NamespaceSchema):
response = self.backend.make_api_request('namespaces', self.name, 'schema', method='POST', payload=request_payload)
return parse_namespace_schema(response["content"])

def copy_from_namespace(self, other_namespace: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

this is more of a personal preference thing: from_namespace/source_namespace/namespace_name would look a bit nicer i think? in case one uses keyword arguments:

ns2.copy_from_namespace(namespace_name=ns1_name)

vs

ns2.copy_from_namespace(other_namespace=ns1_name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went with source_namespace, much cleaner

@@ -1,6 +1,6 @@
[tool.poetry]
name = "turbopuffer"
version = "0.1.28"
version = "0.1.29"
Copy link
Contributor

Choose a reason for hiding this comment

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

also need to update version.py

Signed-off-by: Morgan Gallant <[email protected]>
@morgangallant morgangallant merged commit 0ab3787 into main Feb 20, 2025
6 checks passed
@sirupsen
Copy link
Contributor

The idea is that at some point you can use copy_from_namespace to do schema migrations FWIW

philipk19238 pushed a commit to sweetspot-ai/turbopuffer-python that referenced this pull request Mar 6, 2025
* copy from namespace

Signed-off-by: Morgan Gallant <[email protected]>

* fix namespace names in tests

Signed-off-by: Morgan Gallant <[email protected]>

* address pr comments

Signed-off-by: Morgan Gallant <[email protected]>

---------

Signed-off-by: Morgan Gallant <[email protected]>
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.

3 participants