-
Notifications
You must be signed in to change notification settings - Fork 87
Implement client.replication
namespace for all replicate ops
#1673
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
base: dev/1.31
Are you sure you want to change the base?
Conversation
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.
Orca Security Scan Summary
Status | Check | Issues by priority | |
---|---|---|---|
![]() |
Secrets | ![]() ![]() ![]() ![]() |
View in Orca |
self, | ||
*, | ||
collection: str, | ||
shard: Optional[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.
should this have the default None?
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.
Ah, because of the specific pattern I'm adding in weaviate.replication
, it doesn't use the stubs-auto-gen logic instead spelling out the async_.py
and sync.py
files explicitly, the defaults go in those files with the executor not permitting them. I will remove the default from transfer_type
above to make it clearer
weaviate/replication/models.py
Outdated
|
||
|
||
class _ReplicationReplicateDetailsReplicaStatus(TypedDict): | ||
state: Literal["REGISTERED", "HYDRATING", "FINALIZING", "DEHYDRATING", "READY", "CANCELLED"] |
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.
can't you just use the enum as type here?
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.
These are just the types of the API response so are the types of response.json()
. The Literal
here is for internal use only to avoid serialization. Turning them into enums would just move any error on incompatible types from the public class to this private one
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.
It is more about avoiding duplication - I am sure there will be more states added and then you have to add it in two places (which will be forgotten)
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.
Ideally, these TypedDict
classes would be auto-generated from the schema.json
file, but I don't think such a thing exists. The duplication is a good point, I will simply remove these TypedDict
classes and have the serialisation work on raw dict
. Either way, it needs runtime tests to ensure correctness anyway despite pyright
Great to see you again! Thanks for the contribution. |
No description provided.