Tharun-Kumar
Databricks Employee
Databricks Employee

@102842 

You can first create a variable to extract the value you want. Then you can use python's string formatting to substitute the variable inside the query.

Let's say catalog is the variable name. Then you can perform

command = f"select * from {catalog}.schema.table"
spark.sql(command)