Managing a table relationship in Azure Synapse Analytics

pmscorca 857 Reputation points
2023-10-16T05:59:28.1166667+00:00

Hi,

for a my Synapse Analytics solution I think to manage some relationships between tables created inside a dedicated SQL pool.

In agreement with this article https://learn.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-table-constraints, FOREIGN KEY constraint is not supported in dedicated SQL pool.

Why is not a such feature supported in Synapse?

Is it possible to create and manage a table relationship?

Many thanks

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,553 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,432 Reputation points Microsoft Employee
    2023-10-16T22:00:23.8466667+00:00

    @pmscorca Thanks for using Microsoft Q&A forum and posting your query.

    Why is not a such feature supported in Synapse?

    You are correct that FOREIGN KEY constraints are not supported in Azure Synapse Analytics dedicated SQL pool. This is because dedicated SQL pool is designed to be a distributed system that can scale out to handle large amounts of data, and enforcing FOREIGN KEY constraints across distributed tables can be complex and resource intensive. Relationships is more of an OLTP concept and not common in big data platforms like Azure Synapse Analytics.

    Is it possible to create and manage a table relationship?

    It is not that straightforward as it is not out of box feature. you may workaround by enforcing relationships, you can either do it downstream or on import to your warehouse by identifying the key columns or you can also enforce relationships downstream, for example, in an Azure Analysis Services tabular model or Power BI model.

    But there is no direct or easy way to establish table relationships. Please note that these approaches can be more complex and resource-intensive than using FOREIGN KEY constraints, so you should carefully consider the trade-offs before implementing them as it may result in queries to return inaccurate result.

    Here are helpful related conversations on the same topic, which might be helpful:

    1. Relationships in Azure synapse (DWH)
    2. Create table relationship (PK/FK) on Synapse dedicated SQL pool tables

    Hope this info helps.


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments