Error with Create Table USING DELTA LOCATION in training exercise

James Mitchell 0 Reputation points
2024-05-01T13:00:09.32+00:00

In the exercise https://microsoftlearning.github.io/mslearn-databricks/Instructions/Exercises/03-Delta-lake-in-Azure-Databricks.html

the line of code

spark.sql("CREATE TABLE AdventureWorks.ProductsExternal USING DELTA LOCATION '{0}'".format(delta_table_path))

returns the error AnalysisException: [RequestId=6a2d00e1-908b-4614-96c6-d5953418fa45 ErrorClass=INVALID_PARAMETER_VALUE] GenerateTemporaryPathCredential uri /delta/products-delta is not a valid URI. Error message: INVALID_PARAMETER_VALUE: Missing cloud file system scheme.

Databricks diagnose error suggests changing the code to

spark.sql("CREATE TABLE AdventureWorks.ProductsExternal USING DELTA LOCATION 'dbfs:{0}'".format(delta_table_path))

The updated code returns the error:

AnalysisException: [UC_FILE_SCHEME_FOR_TABLE_CREATION_NOT_SUPPORTED] Creating table in Unity Catalog with file scheme dbfs is not supported. Instead, please create a federated data source connection using the CREATE CONNECTION command for the same table provider, then create a catalog based on the connection with a CREATE FOREIGN CATALOG command to reference the tables therein.

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
1,963 questions
Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,024 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA-MSFT 79,376 Reputation points Microsoft Employee
    2024-05-02T02:56:52.0266667+00:00

    @James Mitchell - Thanks for the question and using MS Q&A paltform.

    Did you run the cell which are created in section Create a notebook and ingest data & Load the file data into a delta table before creating Create catalog tables?

    I had tested the Exercise - Use Delta Lake in Azure Databricks from my end and it's working as excepted with Azure Databricks: 14.3 LTS (includes Apache Spark 3.5.0, Scala 2.12).

    Step1: Create a notebook and ingest data
    User's image

    Step2: Load the file data into a delta table

    User's image

    Step3: Create catalog tables

    User's image

    After follow-up these three steps if you are still expering the same issue, please do let us know on your Azure databricks runtime used?

    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.