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: 

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()

Ajay Kumar Pandey

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?

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