Skip to content

Commit

Permalink
Update function_to_macro.py
Browse files Browse the repository at this point in the history
  • Loading branch information
techvaquero authored Sep 6, 2023
1 parent ed50a4c commit f8e5af0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion helper/function_to_macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import re

dbutils.widgets.text("repo_path", "<user-name>/<repo-path>")
dbutils.widgets.dropdown("targetdb", "snowflake", ["snowflake", "redshift"])

# COMMAND ----------

Expand Down Expand Up @@ -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"]

Expand Down

0 comments on commit f8e5af0

Please sign in to comment.