Workflow parameter in sql not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 08:23 AM
I'm using the following input parameters when running from a workflow:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 08:39 AM
Hi @StevenW ,
I see that you are using python noteboook and then the view is created in SQL.
1. If you are using %sql magic command then to use parameters you need to reference them like $parameter or :parameter (depending on the runtime).
2. If you are using spark.sql to run a query kept in string, then you need to remove $ and use standard string interpolation:
query = f"""
CREATE OR REPLACE TEMP VIEW f0010_view AS
SELECT
TRIM(b.ccco) AS ccco,
TRIM(b.ccname) AS ccname,
TRIM(b.cccrcd) AS cccrcd,
CAST(b.CCDFYJ AS INT) AS CCDFYJ,
{wid_UnityCatalogName}.{wid_UnityCatalogBronzeJDESchema}.f_Convert_JDEJulian_ToDate(CAST(b.CCDFYJ AS INT)) AS FISCAL_YEAR_START_DT,
b.CCPNC AS CCPNC
FROM some_table AS b
"""
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 08:46 AM
Hi @filipnizio
Thanks .. yes, I'm using the %sql command. I used ${xx_lakehouse_dev} and $xx_lakehouse_dev .. for most of the sql in the same notebook, it works fine. Then "suddenly" it doesn't ..?

