How to drop a external table from lake database in Synapse Analytics workspace?

Rajendra kolli 0 Reputation points
2023-06-15T16:19:29.15+00:00
drop EXTERNAL table testdb.dbo.table_name

Error: Operation DROP EXTERNAL TABLE is not allowed for a replicated database.

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,559 questions
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
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bhargava-MSFT 31,261 Reputation points Microsoft Employee Moderator
    2023-06-19T21:01:57.11+00:00

    @Rajendra kolli

    This error usually mean you are trying to execute the operations in the context of a database synced from Spark (replicated database).
    The Lake databases are replicated from the Apache Spark pool and managed by Apache Spark. So, you cannot drop objects in SQL Databases by using T-SQL language.

    Please see this similar thread: https://learn.microsoft.com/en-us/answers/questions/746769/azure-synapse-unable-to-drop-created-table

    You can use the below notebook command to drop your table.

    spark.sql("Drop table if exists tablename")
    
    
    

    https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/resources-self-help-sql-on-demand?tabs=x80070002#operation-isnt-allowed-for-a-replicated-database

    Operation isn't allowed for a replicated database

    This error is returned if you are trying to modify a Lake database, create external tables, external data sources, database scoped credentials or other objects in your Lake database. These objects can be created only on SQL databases.

    The Lake databases are replicated from the Apache Spark pool and managed by Apache Spark. Therefore, you cannot create objects like in SQL Databases by using T-SQL language.

    Only the following operations are allowed in the Lake databases:

    • Creating, dropping, or altering views, procedures, and inline table-value functions (iTVF) in the schemas other than dbo.
    • Creating and dropping the database users from Azure Active Directory.
    • Adding or removing database users from db_datareader schema.

    Other operations are not allowed in Lake databases.


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.