MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / convertCSVFiles

Method convertCSVFiles

test/test_runner/csv_converter.cpp:152–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void CSVConverter::convertCSVFiles() {
153 // Load CSV Files to temp database
154 TestHelper::executeScript(
155 LocalFileSystem::joinPath(csvDatasetPath, std::string(TestHelper::SCHEMA_FILE_NAME)),
156 *tempConn);
157 TestHelper::executeScript(
158 LocalFileSystem::joinPath(csvDatasetPath, std::string(TestHelper::COPY_FILE_NAME)),
159 *tempConn);
160
161 spdlog::set_level(spdlog::level::info);
162 if (fileExtension == ".json") {
163 auto result = tempConn->query(
164 "load extension \"" +
165 TestHelper::appendLbugRootPath("extension/json/build/libjson.lbug_extension\""));
166 if (!result->isSuccess()) {
167 spdlog::error(result->getErrorMessage());
168 }
169 }
170 for (auto table : tables) {
171 spdlog::info("Converting: {} to {}", table->csvFilePath, table->outputFilePath);
172 auto cmd = table->getConverterQuery(tempConn->getClientContext());
173 auto result = tempConn->query(cmd);
174 if (!result->isSuccess()) {
175 spdlog::error(result->getErrorMessage());
176 } else {
177 spdlog::info("Executed query: {}", cmd);
178 }
179 }
180}
181
182void CSVConverter::convertCSVDataset() {
183 LocalFileSystem localFileSystem("");

Callers

nothing calls this directly

Calls 5

getConverterQueryMethod · 0.80
queryMethod · 0.45
isSuccessMethod · 0.45
getErrorMessageMethod · 0.45
getClientContextMethod · 0.45

Tested by

no test coverage detected