hi @jar
This is a frustrating situation where Databricks is deprecating the ${} syntax but the replacement :param syntax doesn't work in all contexts, particularly with CREATE VIEW statements.
1. String Formatting/Templating
Use Python string formatting to build your SQL dynamically:
# Python cell
table_name = "my_table"
filter_value = "some_value"
sql_query = f"""
CREATE OR REPLACE TEMPORARY VIEW my_view AS
SELECT * FROM {table_name}
WHERE column = '{filter_value}'
"""
spark.sql(sql_query)
2. Use Databricks Widgets with String Formatting
If using widgets:
# Python cell
dbutils.widgets.text("param_name", "default_value")
param_value = dbutils.widgets.get("param_name")
create_view_sql = f"""
CREATE OR REPLACE TEMPORARY VIEW my_view AS
SELECT * FROM table
WHERE column = '{param_value}'
"""
spark.sql(create_view_sql)
LR