Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2024 01:30 PM
Remember that keys are for information purposes (they don't validate data integrity). They are used for information in a few places (Feature tables, online tables, PowerBi modelling). The best is to define them in CREATE TABLE syntax, for example:
CREATE TABLE IF NOT EXISTS products (
product_id INT NOT NULL,
CONSTRAINT product_id PRIMARY KEY(product_id)
)
more here https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-create-table-constraint.html
My blog: https://databrickster.medium.com/