Hi, I’ve just created lib supporting postgres identity for non-pk fields which was rejected here.
Any feedback is welcome ![]()
Hope for native Django support in the future ![]()
Hi, I’ve just created lib supporting postgres identity for non-pk fields which was rejected here.
Any feedback is welcome ![]()
Hope for native Django support in the future ![]()
Well done for putting in the effort here, it’s always nice to see another package.
What’s your use case? Maybe you can re-propose the feature based on that.
In my projects we are using UUIDs as primary keys everywhere and there is sometimes a need for adding simple sequence e.g. for some order number or unique code for easy human readable form (instead of UUID). This sequence usually serves as candidate/natural key in URL or data grids or for 3rd party APIs. The main benefits are that the sequences are short and human friendly. Next small benefit is that we are not exposing PK in these cases.
Note, that for complex cases we are also using django-sequences but in the most scenarios we need simple automatically growing sequence which is easy to handle like AutoField.
I’m not sure based on discussion here. But with the great GeneratedField in Django itself, it should be easy. And the following argument from earlier discussion is no more valid because GeneratedField also ignores provided values. So maybe?
For example,
GENERATED ALWAYS AS IDENTITYwould completely ignore any value provided for the field which differs from all the other fields behavior.
The main question is whether anyone needs it like we did ![]()
@adamchainz Thanks for your interest anyway ![]()