#StackBounty: #python #postgresql #sqlalchemy Create a String based sequence in Python SQL Alchemy

Bounty: 50

I’m trying to create a String based sequence in SQLAlchemy ORM. I know that the best practice is to use a Integer based column to manage ID of a table but in my case, due to some requirements of the project I need to store the data as a String based PK for ID’s.

I know that in some databases it is possible to store data using a string based sequence like:

  • “AAA1”
  • “AAA2”
  • “AAAN”

But in SQL alchemy I can’t achieve this by using Sequence method. It only generates Integer based sequences and I can’t find an options to “append” a prefix in the sequence generation.

There is a easy solution to achieve this?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.