diff --git a/helper/function_to_macro.py b/helper/function_to_macro.py index 5aec142..94d4a58 100644 --- a/helper/function_to_macro.py +++ b/helper/function_to_macro.py @@ -17,6 +17,7 @@ import re dbutils.widgets.text("repo_path", "/") +dbutils.widgets.dropdown("targetdb", "snowflake", ["snowflake", "redshift"]) # COMMAND ---------- @@ -135,7 +136,13 @@ def process_file(full_path, functions_list): catalog = dbutils.widgets.get("catalog") schema = dbutils.widgets.get("schema") -input_functionsql = sql('select * from {}.{}.functionlist'.format(catalog, schema)) +targetdb = dbutils.widgets.get("targetdb") +if targetdb == 'snowflake': + input_functionsql = sql('select * from {}.{}.functionlist'.format(catalog, schema)) +elif targetdb == 'redshift': + input_functionsql = sql('select * from {}.{}.functionlistrs'.format(catalog, schema)) +else: + input_functionsql = sql ('select 1') input_functionspd = input_functionsql.toPandas() input_functions = input_functionspd["function_name"]