Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
Where `{{ catalog }}` is a template variable extracted/evaluated from either an environment variable, a databricks secret, or somewhere else? (note: not a widget)
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)
You can define the catalog name as a query parameter. You should declare the catalog name parameter as a drop down list, because if we declare it as a string, it will add single quotes surrounding the value, during the substitution.
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!