1

I'm trying to switch between %python variables and %sql variables in Databricks SQL notebook.

Let's imagine this situation -

%python 
url_var = 'https://www.example.org/localdata_2020_01_01.csv'
%sql 
SET url_sql_var = $(url_var)
-- This doesn't work as expected

But this doesn't work because I'm not sure how to switch between Python & SQL variables in Databricks SQL notebooks.

Kindly help.

1

1 Answer 1

-1

this is not possible . this is the way Databricks notebook has been configured . You can check my answer here

Sign up to request clarification or add additional context in comments.

2 Comments

it's possible, see linked answer
thanks for your details . I agree on your answer if same variable is being used across multiple cells (%python,%sql). But , consider this scenario . %python cell generating variable , if we want to use it in %sql cell is not possible . thats what my answer .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.