cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error occurs on create materialized view with spark.sql

donlxz
New Contributor II

When creating materialized view with spark.sql function it returns following error message.

[MATERIALIZED_VIEW_OPERATION_NOT_ALLOWED.MV_NOT_ENABLED] The materialized view operation CREATE is not allowed: Materialized view features are not enabled for your workspace. Please reach out to Databricks to enable materialized views for your workspace. SQLSTATE: 56038

But I can create materialized view with sql editor, I have create materialized view permission on target catalog and schema.

Is this a known issue with spark.sql ?

1 ACCEPTED SOLUTION

Accepted Solutions

szymon_dybczak
Esteemed Contributor III

Hi @donlxz ,

When you look at documentation, they only available way to create materialized view is by executing CREATE MATERIALIZED VIEW statement. You can submit that statement via SQL editor, Azure Databricks UI, Databricsk CLI or Databricks SQL API. 

szymon_dybczak_0-1760449975337.png

 

Use materialized views in Databricks SQL - Azure Databricks | Microsoft Learn

So, you can't create materialized view wiht spark.sql approach.

View solution in original post

2 REPLIES 2

szymon_dybczak
Esteemed Contributor III

Hi @donlxz ,

When you look at documentation, they only available way to create materialized view is by executing CREATE MATERIALIZED VIEW statement. You can submit that statement via SQL editor, Azure Databricks UI, Databricsk CLI or Databricks SQL API. 

szymon_dybczak_0-1760449975337.png

 

Use materialized views in Databricks SQL - Azure Databricks | Microsoft Learn

So, you can't create materialized view wiht spark.sql approach.

donlxz
New Contributor II

Hi, @szymon_dybczak 

Thank you for your response.
You're right, it was mentioned in the documentation—I missed it when checking.
I understand now that it's not possible to do this with spark.sql. Thanks for clarifying!

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now