Dynamic Primary Keys

9 views
Skip to first unread message

Nick Leaton

unread,
Mar 3, 2020, 1:26:52 PM3/3/20
to sqlalchemy
A how to question. 

I'd like to be able to create a table which has dynamic primary keys. 

Something along these lines. 

Lets say the main table is called Master. it has a generated id.

Then a table that is an id and a name, called AliasType. 

It's then a many to many association between Master and AliasType, where the association, Alias,  also contains a field called alias. 

If a master record is deleted, then the Alias(es) get deleted. The Alias Type can't be deleted unless there are no Aliases, its an orphan.

What's the best implementation?

Thanks

N
Reply all
Reply to author
Forward
0 new messages