-
Notifications
You must be signed in to change notification settings - Fork 126
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
Allow to use natural primary/foreing keys for geoname objects. #217
Comments
+1 This would be really handy |
Actually, wouldn't it be more feasible to use geoname_id as the primary key in each model? It is unique already (locally and from the data source), and it's portable between datasets. |
I think that change the primary key will be something out of scope, for the complexity to do the migration for all the users of this library. But I like the idea of using natural keys to dump and load the data into the system. On the development branch, you can test initial support of this feature. The feedback is appreciated!! |
…217 (#245) * fix: return to dbdiff and removed django2.0 from tests * fix: fixture geoname_id instead of pk * feat: type annotation * fix: geoname id * Builtins not required * fix: changes to support natural key on tests (#244) * pep8 * pep8 * CHANGELOG Co-authored-by: marianoeramirez <Sosinformatico1990>
The solution to this problem is already live on version 3.9. Still left write the documentation about this but closing this ticket for now. |
Current default model implementation relies on a sequence as a primary key value for each model. This leads to a situation where two sibling deployments may have different IDs for the same objects, when cities_lights import was run in a different time frame or with different order of objects imported. An interchange of other data that relies on
cities_light
models between those two may be difficult in such situation.A solution would be to support natural primary/foreign keys in models and use them in dump/load commands: https://docs.djangoproject.com/en/3.0/topics/serialization/#natural-keys
The text was updated successfully, but these errors were encountered: