PrimaryKeyCreator, no parameter are passed to the create_pk method
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
I want to make an MurmurHash class to create a primary key for a new model instance.
I did this class that adheres to the PrimaryKeyCreator protocol:
# https://github.com/hajimes/mmh3
import mmh3
class Mmh3PrimaryKey:
"""
A client-side generated primary key that follows the MurmurHash (MurmurHash3) spec.
https://en.wikipedia.org/wiki/MurmurHash
"""
@staticmethod
def create_pk(self, *args, **kwargs) -> str:
return str('some argument in args / kwargs')
and set Meta primary_key_creator_cls like this:
class ErrorServer(HashModel):
local_hostname: str
class Meta:
primary_key_creator_cls = Mmh3PrimaryKey
But when I instantiate ErrorServerclass, no parameter (len of *args, **kwargs == 0) are passed to create_pk
es = ErrorServer(local_hostname='my_hostname', param2='Test')
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the PrimaryKeyCreator protocol in aredis_om/model/model.py around line 856 and the primary_key_creator_cls documentation in docs/models.md. Trace model instantiation for ErrorServer and verify whether constructor values reach create_pk; done means the documented creator receives the expected arguments, with coverage for the reported instantiation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, redis
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100