Best practice on generating primary keys with table name based prefix? #1274
Unanswered
vinod-canihelp
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
The code shared above is great for creating unique randomly generated ids as primary key for all tables. I want to have a prefix based on the table name. How can I do it?
Current ids are like "bZwYnlG1kdGMCbx" and "DuDvRnZOXIDvvqs" for User and Organization table.
I want the ids to be "user_bZwYnlG1kdGMCbx" and "organization_DuDvRnZOXIDvvqs" for the User and Organization tables respectively.
Ideally the code for this is refactored like the TableIds class
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.22
Python Version
3.11.8
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions