idea: Add new prefixes and resource IDs
Companies like Stripe and AWS use prefixed resource IDs to allow users and developers to much more easily identify resources.
For example, our current system has ids like 1235, whereas stripe has inv_3LKQhvGUcADgqkAd5bd6pslE or AWS has like i-12dNk2354asdhsa.
The prefixes inv-, i-, cl_ etc all help with identifying the object type without needing to know extra details, useful for debugging and being human readable for users.
I think it'd be ideal for us to move to this design too, but it'll need a bit of rethinking and model changes.
We'd need a random character based string for IDs rather than integers, like UUIDs, so they can't be guessed - this is generally good in general for any public facing things anyways. And then we'd append the prefix via a model manager or something of the kind.
Seems like a waste of storage (even though only a few bytes) to append the prefix in DB, so I feel like it should be done on the backend.
All items should still have their NORMAL autoincrement ID, but this will never be publicly facing. I believe this is ideal to still have as it is good for efficiency in DB lookups and indexing - correct me if i'm wrong though.
A possible django solutionwould be something like:
resource_id_raw = UUID()
@property
def resource_id(self)
return f'prefix_{self.resource_id_raw}'
Then you just use invoice.resource_id or x.resource_id and that becomes a globally used thing instead of number IDs.
We could have shorter aliases such as rid too, as long as it's not confusing.
Any thoughts?
Hi! My name is Lamia and I’ve never contributed to an open source project before, but I’d like to try working on this issue! Is it still available?
Hello, we are a group of university students working on an open-source contribution assignment. We'd like to work on this issue—can it be assigned to me?
Hello, I am student and looking to contribute to an open-source project. is anyone working on this issue, if not can I work on this issue.
Hi both, unfortunately this issue is paused for a while as there are more complications than I realised and would require changes in almost every file.
If you'd like to discuss it let me know, but implementation isn't useful until we've thought it through and came up with a decision
hey,let me know your issue and I'll help you out . i have experience of building finance platform. thank you.
Hi, here you can check my proposal to the UUIDs issue: https://github.com/TreyWW/MyFinances/pull/613