Update of an external table in Azure Synapse

Peter Polacek 25 Reputation points
2024-12-11T16:36:36.16+00:00

Hello,

we are using external tables which are defined for example like this:

CREATE EXTERNAL TABLE [TEST].[TEST_TABLE] WITH (    
    LOCATION = '
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.
5,373 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
0 comments No comments
{count} votes

Accepted answer
  1. Azar 29,520 Reputation points MVP Volunteer Moderator
    2024-12-11T17:54:39.9233333+00:00

    Hi there Peter Polacek

    Thanks for using QandA platform

    External tables in Azure Synapse Analytics are read-only, so you cannot directly update them. Instead, try updating the underlying data files in Azure Data Lake that the external table references. To do this, you can use Azure Data Factory, Synapse Pipelines, or Spark notebooks to modify the data in place. Once the underlying data is updated, the external table will automatically reflect these changes.

    If you want to manage updates dynamically, you can create a view on top of the external table that combines the original data with new or updated records from another source. For exmple.

    CREATE OR ALTER VIEW [TEST].[UPDATED_VIEW] AS
    SELECT * 
    FROM [TEST].[TEST_TABLE]
    UNION ALL
    SELECT * 
    FROM [UpdatedRecords]; -- This source contains new or updated records
    
    
    

    If this helps kindly accept the answer thanks much.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.