Closed amotl closed 11 months ago
crate/crate-python#585 will resolve this by adding a corresponding section to the documentation, to use the gen_random_text_uuid()
scalar function [^1], which can also be used within an SQL DDL statement, in order to automatically assign random identifiers to newly inserted records on the server side. In this spirit, it is suitable to be used as a PRIMARY KEY
constraint for SQLAlchemy.
[^1]: Available since CrateDB 4.5.0.
Introduction
CrateDB's
gen_random_text_uuid()
function generates UUID values suitable to be used as auto-generated primary key values, instead of PostgreSQL'sSERIAL
type.Objective
It would be sweet if we could make the CrateDB SQLAlchemy dialect support this feature appropriately.
Proposal
I think the right way is to implement a custom SQLAlchemy column definition like that:
References