cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to create a table in databricks sql using widget values in table naming. The idea is that the users could select / enter table naming values as they create their tables. This can be done in notebooks but I can't get the syntax working in DBSQL.

Juha
New Contributor II

Here's an example:

CREATE OR REPLACE TABLE {{workspace}}.{{TableNameFirstPart}}_{{TableNameEndPart}}

AS SELECT ...

3 REPLIES 3

Ajay-Pandey
Esteemed Contributor III

Hi @Juha Leppänen​ please refer below code-

val = '2020-04-08'
 
spark.sql("SELECT * FROM MYTABLE WHERE TIMESTAMP  BETWEEN {}  AND '2020-04-08'".format(val)).show()

Juha
New Contributor II

Hi @Ajay Pandey​  and thank you for your response, but this doesn't answer my question.

lawrence009
Contributor

Have you figured out what the problem was? Could the issue be permission related?

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.