Harsimranjeet Singh
Harsimranjeet Singh

Reputation: 524

Can't we create Managed Table with Foreign key in Azure data lake

I was looking into documentation while creating tables but so far example didn't mentioned ,how to add foreign key while creating table. Also I check documentation for Alter statement too, but same goes with this too

  CREATE TABLE Brand (
            BrandId          int,            
            Name         string,
            AddressId           int,
            SuperAdminDetails string,
           CONSTRAINT FK_Address FOREIGN KEY (AddressId) REFERENCES Address(AddressId) ,

            INDEX Brand_idx CLUSTERED (BrandId ASC) 
                  PARTITIONED BY HASH (BrandId)
  );


  // ALTER TABLE Brand ADD CONSTRAINT FK_Address FOREIGN KEY (AddressId) REFERENCES Address(AddressId) ;

Error While Executing Above USQL

enter image description here

Upvotes: 3

Views: 187

Answers (1)

wBob
wBob

Reputation: 14379

U-SQL as per the documentation does not currently support foreign keys. If you require this functionality consider hosting your data in an Azure SQL Database (which does support foreign keys) and using federated queries to query the data where it lives. Alternately consider making a feedback request:

https://feedback.azure.com/forums/327234-data-lake/filters/hot?page=2

Upvotes: 1

Related Questions