| 477 | } |
| 478 | |
| 479 | void upsert_columns(const std::string& root_path, icm::string_map<> creds, const std::vector<column_meta>& columns) |
| 480 | { |
| 481 | if (columns.empty()) { |
| 482 | return; |
| 483 | } |
| 484 | auto table = open_catalog_table(root_path, k_columns_name, std::move(creds)); |
| 485 | icm::vector<icm::string_map<nd::array>> rows; |
| 486 | rows.reserve(columns.size()); |
| 487 | for (const auto& col : columns) { |
| 488 | icm::string_map<nd::array> row; |
| 489 | // column_id is the composite key: table_id:column_name |
| 490 | row["column_id"] = nd::adapt(col.table_id + ":" + col.column_name); |
| 491 | row["table_id"] = nd::adapt(col.table_id); |
| 492 | row["column_name"] = nd::adapt(col.column_name); |
| 493 | row["pg_type"] = nd::adapt(col.pg_type); |
| 494 | row["dl_type_json"] = nd::adapt(col.dl_type_json); |
| 495 | row["nullable"] = nd::adapt(col.nullable); |
| 496 | row["position"] = nd::adapt(col.position); |
| 497 | rows.push_back(std::move(row)); |
| 498 | } |
| 499 | table->upsert_many(std::move(rows)).get_future().get(); |
| 500 | } |
| 501 | |
| 502 | int64_t get_catalog_version(const std::string& root_path, icm::string_map<> creds) |
| 503 | { |
no test coverage detected