简体   繁体   中英

How do I set a variable in Foundry's SQL Transforms?

Is there a way to set variables in Foundry's transforms-sql? I have a list of values that I reference multiple times in a query that would ideally just specify once.

Currently doing: SELECT * FROM foo WHERE param IN ('a', 'b', 'c')

Want to do something like: SET param_list = ('a', 'b', 'c') SELECT * FROM foo WHERE param IN @param_list

Unfortunately, SparkSQL as a language doesn't support variables yet, so your best alternative would be to rewrite this transform in Python. It will support dynamic queries, parameters, and all manner of more expressive queries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM