Synapse Analytics Lakehouse Schema Creation Error

Saravanan Kumar 0 Reputation points
2024-04-08T06:28:19.99+00:00

Hi All,

I'm working in Synapse Analytics Lakehouse Database to create table with new schema, I have already a Database Core when i try to execute below code for creating my new table in new schema its not allowing me to create the table

PySpark Code:

df.write.mode("overwrite").saveAsTable(s"core.Deal.$TABLE_NAME_NEW")

Error Message : org.apache.spark.sql.AnalysisException: Couldn't find a catalog to handle the identifier core.Deal.stg_tbl_DEAL_BULK_Opportunities.

Could you please let me know like how to create table under new schema instead of creating in dbo.

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,919 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Smaran Thoomu 15,845 Reputation points Microsoft Vendor
    2024-04-08T08:17:55.6666667+00:00

    Hi @Saravanan Kumar

    Thank you for reaching out to the community forum with your query.

    As I understand you’re encountering an issue while creating a table in a new schema within Synapse Analytics Lakehouse Database. Let’s address this!

    The error message you received indicates that the catalog couldn’t find the specified identifier (core.Deal.stg_tbl_DEAL_BULK_Opportunities). This could be due to incorrect schema or table names. Let’s address this!

    1. Creating a Table in a New Schema: To create a table in a new schema, you can follow these steps: Step 1: Define Your Schema: Decide on the name of your new schema. For example, let’s call it my_new_schema. Step 2: Create the Table: Use the following PySpark code snippet to create your table in the desired schema:
         # Replace 'my_new_schema' and 'my_table_name' with your actual schema and table names df.write.mode("overwrite").saveAsTable("my_new_schema.my_table_name")
      
      Step 3: verify the Table: After executing the code, verify that the table has been created in the specified schema.
    2. Ensure that the schema exists before creating the table.
    3. Double-check the schema and table names for typos or inconsistencies.

    Reference:

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer 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.