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

[Question] Why is BaseResource._ids yielding primary keys twice ? #55

Open
cans opened this issue Nov 4, 2017 · 1 comment
Open

[Question] Why is BaseResource._ids yielding primary keys twice ? #55

cans opened this issue Nov 4, 2017 · 1 comment

Comments

@cans
Copy link
Contributor

cans commented Nov 4, 2017

The BaseResource._ids property yields all so called primary keys twice, once as the value of the attribute itself, once as the value of the attribute cast to a string with str.

Several questions about that:

  • Why doing so ? What is the use case ?
  • If there is a use case indeed, nothing prevents me to use an array, dict or object attribute as a key. What would be the meaning of str(object) ?

Not convinced that works well and since it is not used anywhere in the code, not sure there actually is a need for this.

Also as a side note, I think the name _pks is very much misleading. An entity can only have several keys but only one primary key (which is where I guess pk in _pks is coming from).

I welcome any feedback on this. Thanks in advance.

@cans cans changed the title Why is BaseResource._ids yielding primary keys twice ? [Question] Why is BaseResource._ids yielding primary keys twice ? Nov 4, 2017
@martyzz1
Copy link
Owner

martyzz1 commented Nov 7, 2017

I'll have to come back to you on this. Off the top of my head I think this was part of the original inherited code from the heroku.py project.

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

No branches or pull requests

2 participants