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:ย 

SQL Identifier clause

jura
New Contributor II

Hi, 

I was trying to prepare some dynamic SQLs to create table using the IDENTIFIER clause and WITH AS clause, but I'm stuck on some bug as it seems. 
could someone verify it or tell me that I am doing something wrong?
code is running on SQL Warehouse 

Thanks in advance

Case 1 => Create Table Conventional => Success

 

jura_2-1710922868633.png

Case 2 => Create Table using IDENTIFIER clause (without with as clause) => Success

jura_3-1710923081107.png

Case 3 => Create Table using IDENTIFIER clause and using WITH AS clause => FAIL

jura_4-1710923152252.png

I've tried using brackets around with as and select, didn't help ..

 

Any suggestions? 

#identifier #sql

2 REPLIES 2

raphaelblg
Databricks Employee
Databricks Employee

Hello @jura ,

I'm Raphael and i'll be helping you out.

The approach below should work:

USE CATALOG dev;

CREATE OR REPLACE TABLE IDENTIFIER("bronze.jura_test")
as SELECT ...

Please let me know the outcome and feel free to ask any further questions. If my response addresses your needs then please mark it as the official solution.

Thanks!

Best regards,

Raphael Balogo
Sr. Technical Solutions Engineer
Databricks

jura
New Contributor II

Hi @raphaelblg 

thanks for your answer, but this doesn't work.

jura_0-1711092079664.png

Problem is in WITH AS clause, when it is used in combination of CREATE TABLE and IDENTIFIER functions. Your example is same as my case 2 in opening post. 

Do you have any other propositions ? 

Another thing that I've found is that in SQL notebook + SQL Warehouse parameters cannot be used for some commands, i.e. USE CATALOG.  

jura_1-1711092347117.png

Thanks for your answer, but if you have any other suggestions, feel free to share 

br
Dino

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group