-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
Signed-off-by: Morgan Gallant <[email protected]>
Signed-off-by: Morgan Gallant <[email protected]>
turbopuffer/namespace.py
Outdated
@@ -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): |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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]>
The idea is that at some point you can use copy_from_namespace to do schema migrations FWIW |
* 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]>
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