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?

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