DolphinDB: Create multiple in-memory tables with the same schema

47 Views Asked by At

I want to create 100 tables in batches and preallocate enough underlying memory for them. In addition to using the for loop to dynamically add elements, is there any way more convenient?

//initialize tables list_tables

 list_tables=[table(150000:0, `trade_day`secu_code`factor_value, `INT`INT`DOUBLE),
       table(150000:0, `trade_day`secu_code`factor_value, `INT`INT`DOUBLE),
       table(150000:0, `trade_day`secu_code`factor_value, `INT`INT`DOUBLE),
       table(150000:0, `trade_day`secu_code`factor_value, `INT`INT`DOUBLE),
       table(150000:0, `trade_day`secu_code`factor_value, `INT`INT`DOUBLE)]
1

There are 1 best solutions below

0
Polly On BEST ANSWER

You can use function each and lambda to create multiple tables.

list_tables=each(x->table(150000:0, `trade_day`secu_code`factor_value, `INT`INT`DOUBLE),1..100)
>list_tables[0];
trade_day secu_code factor_value
--------- --------- ------------