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

Primary keys being ignored and set to UUIDs #66

Open
diva opened this issue Jul 9, 2016 · 1 comment
Open

Primary keys being ignored and set to UUIDs #66

diva opened this issue Jul 9, 2016 · 1 comment

Comments

@diva
Copy link

diva commented Jul 9, 2016

If I have this model:

@pcc_set
class OSMModelRequest(object):
    @primarykey(int)  <----------------------
    def ReqId(self):
        return self._ReqId

    @ReqId.setter
    def ReqId(self, value):
        self._ReqId = value

    def __init__(self, id, sender):
        self.ReqId = id

the objects at the store acquire a UUID as ReqId.

If I change the model to this, the primary key is fine:

@pcc_set
class OSMModelRequest(object):
    @primarykey(str)  <----------------------
    def ReqId(self):
        return self._ReqId

    @ReqId.setter
    def ReqId(self, value):
        self._ReqId = value

    def __init__(self, id, sender):
        self.ReqId = id


@arthur00
Copy link
Member

Only strings are allowed as primary keys for now. Since primary keys are used for dictionary checking and serializing dictionaries only works if keys are strings, it is necessary that all backend primary keys be strings. However it is perfectly possible to simply convert from any object to string and vice-versa to allow for other types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants