Reputation: 15
I'm new to Databricks and when I want to alter my SQL tables by adding primary or FK, I get an absurd error that can't seem to debug it.
%sql
ALTER TABLE samples_abp215dsdp ADD CONSTRAINT PRIMARY (SampleID);
here is the error message:
Error in SQL statement: ParseException:
mismatched input '(' expecting {'CHECK', 'FOREIGN', 'PRIMARY', 'UNIQUE'}(line 1, pos 55)
== SQL ==
ALTER TABLE samples_abp215dsdp ADD CONSTRAINT PRIMARY (SampleID)
------------------------------------------------------^^^
any help will be appreciated.
Upvotes: 1
Views: 7382
Reputation: 3230
spark do not have any concept of primary key. As spark is computation engine not database.
There are new features coming in 2022. Follow below list:
In 2023:
Refer this link
Upvotes: 3