How to pass task name as parameter in scheduled job that will be used as a schema name in query
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 05:21 PM
I want to run a parametrized sql query in a task. Query:
select * from {{client}}.catalog.table
with client value being {{task.name}}.
if client is a string parameter, it is replaced with quotes which throws an error.
if table is a dropdown list parameter, it throws: The following parameter values are invalid: [{'key': 'client', 'value': 'randomclient'}].
How can I solve?
Labels:
- Labels:
-
Workflows
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 08:22 AM
Try this:
select * from identifier(:catalog||'.schema.table')
The :catalog is a parameter within DBSQL
Replace schema and table with actual names