In Python, I can unpack a list into individual variables:
>>> name,age,date = ['Bob',20,'2025-1-1']
>>> name
'Bob'
>>> age
20
>>> date
'2025-1-1'
In DolphinDB, I want to achieve a similar “unpacking” operation for column names stored in a list. For example, given a table T and a name_set list containing column names, how can I dynamically unpack these names into a SQL query to select those columns?
T = table(1..3 as id, 2..4 as val1, 3..5 as val2, 4..6 as val3)
name_set = ["val1", "val2", "val3"]
// Goal: Equivalent to `select val1, val2, val3 from T`
select *name_set from T // Hypothetical syntax (not working)
I have tried directly using select *name_set fails because DolphinDB does not support unpacking syntax like Python. I’ve explored using meta programming but haven’t found a clear way to dynamically unpack column names from a list.
How can I programmatically expand the name_set list into column names in a DolphinDB SQL query, similar to Python’s unpacking?