- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 06:34 AM
I got parseException issue and I have no idea what cause the problem:
ParseException: mismatched input 'PRIMARY' expecting {')', ',', 'CONSTRAINT'}(line 2, pos 44)
== SQL ==
CREATE TABLE persons(first_name STRING NOT NULL, last_name STRING NOT NULL, nickname STRING, CONSTRAINT person_pk PRIMARY KEY (first_name, last_name)
--------------------------------------------^^^
)
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 05:29 AM
You can only declare Primary and foreign keys on fields on Unity Catalog.
You also need Databricks Runtime 11.1+
Otherwise only NOT NULL and CHECK constraints are supported.
More info : https://docs.databricks.com/tables/constraints.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 10:41 AM
I think the issue is Only CHECK constraints are currently supported
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 05:29 AM
You can only declare Primary and foreign keys on fields on Unity Catalog.
You also need Databricks Runtime 11.1+
Otherwise only NOT NULL and CHECK constraints are supported.
More info : https://docs.databricks.com/tables/constraints.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 05:31 AM
Hello erigaud,
Thanks for your answer, had the same issue.