Hi,
I have defined a delta table with a primary key:
%sql
CREATE TABLE IF NOT EXISTS test_table_pk (
table_name STRING NOT NULL,
label STRING NOT NULL,
table_location STRING NOT NULL,
CONSTRAINT test_table_pk_col PRIMARY KEY(table_name)
) USING DELTA
LOCATION "abfss://raw@Table_Path"
I want column "table_name" to be unique. However, I can insert rows with the same "table_name" as below:
%sql
INSERT INTO test_table_pk
VALUES ('table_2', 'label_2', 'path_2'),
('table_2', 'label_2', 'path_3');
In the table:
I tried to add a unique constraint for column "table_name":
"CONSTRAINT test_table_unique_col UNIQUE(table_name)
but I get the error:
Only PRIMARY KEY and FOREIGN KEY constraints are currently supported
How can I add a constraint to the column "table_name" to accept only unique values?