You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CrateDB's gen_random_text_uuid() function generates UUID values suitable to be used as auto-generated primary key values, instead of PostgreSQL's SERIAL type.
crash <<EOL
DROPTABLE IF EXISTS testdrive;
CREATETABLEIF NOT EXISTS "doc"."testdrive" (
"x"TEXT DEFAULT gen_random_text_uuid() NOT NULL,
"y"INT
);
INSERT INTO testdrive (y) VALUES (42);
INSERT INTO testdrive (y) VALUES (42);
REFRESH TABLE testdrive;
SELECT*FROM testdrive;
EOL
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:
The text was updated successfully, but these errors were encountered:
amotl
changed the title
SQLAlchemy: Support for gen_random_text_uuid() in DDL statement
SQLAlchemy/DDL: Support custom crate_autogenerate_uuid column definition option
Mar 6, 2023
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.
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
The text was updated successfully, but these errors were encountered: