Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kmascent
Regular Visitor

The schema `delta` cannot be found error after first execution of delta table creation with path

Below statement works fine for the first time in Microsoft Fabric, subsequent execution throwing schema not found error.

 

 

%%sql
create table if not exists delta.`Files/deltatables/table5`
(
    id integer,
    name string
)using delta
 

[SCHEMA_NOT_FOUND] The schema `delta` cannot be found. Verify the spelling and correctness of the schema and catalog. If you did not qualify the name with a catalog, verify the current_schema() output, or qualify the name with the correct catalog. To tolerate the error on drop use DROP SCHEMA IF EXISTS.

5 REPLIES 5
ibarrau
Super User
Super User

Hi. I haven't seen that way of creating the table before. Are you trying to create a delta table at "Tables" Lakehouse section?

When I'm working in order to move a table from Files to Tables, I usually load it as temp table to make some transformations or join and then store it at Tables. Like this:

 

CREATE OR REPLACE TEMPORARY VIEW Dim_Shipments_Temp
USING PARQUET
OPTIONS(path "Files/Silver/Shipments/*.parquet", header "true", mode "FAILFAST");

DROP TABLE IF EXISTS Dim_Ship;
CREATE TABLE Dim_Ship USING delta
AS SELECT * FROM Dim_Shipments_Temp 
--[After the "AS" the select would have a transformation of temp queries, as an example it's just SELECT *

 

I guess if you just want to create the table from a file directly you can write like:

 

CREATE TABLE products
USING DELTA
LOCATION 'Files/external_products';

 

I hope that helps


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Thanks for the response.
In my case I'm trying to create the structure for target first and load the data to target  incrementally. 
Creating delta table under tables section ("Tables" Lakehouse section) works fine, but I want to create it using folder structure under Files section within lakehouse 
Here is the link to reference script:
https://docs.delta.io/latest/delta-batch.html#-deltausegeneratedcolumns&language-sql 

kmascent_0-1712952858810.png

 

Hi I haven't seen a way to insert with only sql to files at fabric. If you want to try it make sure you are querying the right schema. Check your schema with:

%%sql
SELECT current_schema()

That will show if "delta" is ok. I would say it might be the name of the lakehouse. 

 

As an alternative, you can consider pyspark. Have you tried delta api instead?

# Create or replace table with path and add properties
DeltaTable.createOrReplace(spark) \
  .addColumn("id", "INT") \
  .addColumn("firstName", "STRING") \
  .addColumn("middleName", "STRING") \
  .addColumn("lastName", "STRING", comment = "surname") \
  .addColumn("gender", "STRING") \
  .addColumn("birthDate", "TIMESTAMP") \
  .addColumn("ssn", "STRING") \
  .addColumn("salary", "INT") \
  .property("description", "table with people data") \
  .location("/tmp/delta/people10m") \
  .execute()

 I hope that helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Hi @kmascent 

 

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.


Thanks.

Hi @kmascent 

 

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others .
If you have any question relating to the current thread, please do let us know and we will try out best to help you.
In case if you have any other question on a different issue, we request you to open a new thread.

 

Thanks.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors