ini_data_table.dos 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. login(`admin, `123456);
  2. use fundit::sqlUtilities;
  3. /*
  4. * 初始化建库
  5. */
  6. directory = "dfs://fundit/mfdb/";
  7. // dropDatabase(directory);
  8. // Not sure why PKEY cannot be used
  9. db = database(directory, partitionType=HASH, partitionScheme=[SYMBOL, 5], engine='TSDB');
  10. directory = "dfs://fundit/pfdb/";
  11. db = database(directory, partitionType=HASH, partitionScheme=[SYMBOL, 5], engine='TSDB');
  12. directory = "dfs://fundit/raw_db/";
  13. db = database(directory, partitionType=HASH, partitionScheme=[SYMBOL, 5], engine='TSDB');
  14. /*
  15. * 初始化建表
  16. *
  17. */
  18. db = get_local_database('fundit', 'mfdb');
  19. tb_nav = table(100:0, ['entity_id', 'price_date', 'cumulative_nav', 'nav', 'isvalid', 'createtime', 'updatetime'],
  20. [SYMBOL, DATE, DOUBLE, DOUBLE, INT, DATETIME, DATETIME]);
  21. //dropTable(db, 'public_nav');
  22. createPartitionedTable(db, tb_nav, 'public_nav', partitionColumns='entity_id', sortColumns=['entity_id', 'price_date'], keepDuplicates=LAST);
  23. createPartitionedTable(db, tb_nav, 'nav', partitionColumns='entity_id', sortColumns=['entity_id', 'price_date'], keepDuplicates=LAST);
  24. createPartitionedTable(db, tb_nav, 'market_indexes', partitionColumns='entity_id', sortColumns=['entity_id', 'price_date'], keepDuplicates=LAST);