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

3 REPLIES 3

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

vinay_yogeesh
New Contributor II

Hey, I am struck with the same issue, did you find any workaround. I am trying to run DESCRIBE & ALTER command using IDENTIFIER() using databricks-sql-connector. Did u figure out how to run the identifier command statements??

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