Creating surrogate key with an Identity column in Delta lake
Just wanted to know how others are dealing with creating surrogate key with auto-increment in delta table. Seems this is something supported in Databricks, but not in fabric.
in Databricks:
CREATE OR REPLACE TABLE demo (
id BIGINT GENERATED ALWAYS AS IDENTITY,
product_type STRING,
sales BIGINT
);
Going forward, the identity column titled "id" will auto-increment whenever you insert new records into the table. You can then insert new data like so:
INSERT INTO demo (product_type, sales)
VALUES ("Batteries", 150000);
0
2 comments
Sreedhar Vengala
3
Creating surrogate key with an Identity column in Delta lake
Learn Microsoft Fabric
skool.com/microsoft-fabric
Helping passionate analysts, data engineers, data scientists (& more) to advance their careers on the Microsoft Fabric platform.
Leaderboard (30-day)
Powered by