Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated SQL CHECK Constraint Generation #178

Open
alan-francis opened this issue Dec 26, 2023 · 0 comments
Open

Automated SQL CHECK Constraint Generation #178

alan-francis opened this issue Dec 26, 2023 · 0 comments

Comments

@alan-francis
Copy link
Collaborator

I would like to propose an enhancement to the library to automate the generation of SQL CHECK constraints, taking into consideration existing unique constraints. Currently, users manually specify CHECK constraints when creating tables, which can be cumbersome and prone to errors.

I suggest incorporating a feature into the library that simplifies the definition of SQL CHECK constraints. Users should be able to express constraints more abstractly, specifying the allowed values for a column without having to write the entire CHECK constraint manually.

Consider the following SQL table creation script with both UNIQUE and CHECK constraints:


CREATE TABLE "synthetic_table_with_constraints" (
    "text_primary_key" TEXT PRIMARY KEY NOT NULL,
    "column_unique" TEXT NOT NULL,
    "column_check" TEXT NOT NULL CHECK (column_check IN('ACTIVE','INACTIVE')),
    "created_at" DATE,
    UNIQUE("column_unique")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant