Forum Discussion

Arjunrathod's avatar
Arjunrathod
Frequent Visitor
10 months ago
Solved

ERROR: [REQUIRES_SINGLE_PART_NAMESPACE] spark_catalog requires a single-part namespace

Scenario:
Bronz

  • lakehouse Schema enabled: raw_test
  • Tables: text_x, test_y

    Notebook:

test_notebook 

Code:

  • %%sql
    CREATE OR REPLACE TEMPORARY VIEW temp_view AS(
    SELECT Col1,Col2,Col3 FROM raw_test.dbo.testx
    UNION ALL
    SELECT Col1,Col2,Col3 FROM raw_test.dbo.testy
    );

    Define Query
    query = 'SELECT col1, col2 FROM temp_view'

    #execute Query
    df = spark.sql(query)

     

    When I execute spark query I am getting following error:
    AnalysisException: [REQUIRES_SINGLE_PART_NAMESPACE] spark_catalog requires a single-part namespace, but got `raw_test`.`dbo`

    NOTE: it was working good wihout Schema Enabeled lkaehouse.

  • Hi , check if you have a lakehouse attached to your notebook. Then you might want to try and remove the database name raw_test from the your query or added the workspace name as a prefix. Something like this.

    CREATE OR REPLACE TEMP VIEW temp_view AS
    SELECT Col1, Col2, Col3
    FROM   dbo.testx
    UNION ALL
    SELECT Col1, Col2, Col3
    FROM   dbo.testy;

    or

    CREATE OR REPLACE TEMP VIEW temp_view AS
    SELECT Col1, Col2, Col3
    FROM   your_workspace.raw_test.dbo.testx
    UNION ALL
    SELECT Col1, Col2, Col3
    FROM   your_workspace.raw_test.dbo.testy;
     
    Hope this helps. If so, please give a Kudos 👍

    Arjunrathod

2 Replies

  • Hi , check if you have a lakehouse attached to your notebook. Then you might want to try and remove the database name raw_test from the your query or added the workspace name as a prefix. Something like this.

    CREATE OR REPLACE TEMP VIEW temp_view AS
    SELECT Col1, Col2, Col3
    FROM   dbo.testx
    UNION ALL
    SELECT Col1, Col2, Col3
    FROM   dbo.testy;

    or

    CREATE OR REPLACE TEMP VIEW temp_view AS
    SELECT Col1, Col2, Col3
    FROM   your_workspace.raw_test.dbo.testx
    UNION ALL
    SELECT Col1, Col2, Col3
    FROM   your_workspace.raw_test.dbo.testy;
     
    Hope this helps. If so, please give a Kudos 👍

    Arjunrathod