Skip to content

Change PartitionKeyType from List to Sequence? #34313

@trevorcreech

Description

@trevorcreech

Describe the bug
First off, thanks for all the typing you all have added!

Our partition_keys are always strings so we'd like our internal methods to have type Union[str, list[str], None], but that's not compatible with the PartitionKeyType in the SDK because lists are mutable

GitHub issue with explanation of why list[str] isn't compatible with e.g. list[str | int]

Assuming these functions never modify the partition_keys that are passed in, so could we change that type from List to Sequence?

To Reproduce
mypy playground: List failure case
mypy playground: Sequence success case

Expected behavior
Users of the sdk can restrict their partition key types to a stricter subset

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.Cosmoscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions