Skip to content

Commit 03e0e51

Browse files
committed
Fix Code: 81. DB::Exception: Database _temporary_and_external_tables does not exist. (UNKNOWN_DATABASE)
1 parent 26a264b commit 03e0e51

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

programs/local/LocalChdb.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -260,38 +260,6 @@ connection_wrapper::build_clickhouse_args(const std::string & path, const std::m
260260
return argv;
261261
}
262262

263-
void connection_wrapper::initialize_database()
264-
{
265-
if (is_readonly)
266-
{
267-
return;
268-
}
269-
if (is_memory_db)
270-
{
271-
// Setup memory engine
272-
query_result * ret = query("CREATE DATABASE IF NOT EXISTS default ENGINE = Memory; USE default");
273-
if (ret->has_error())
274-
{
275-
auto err_msg = fmt::format("Failed to create memory database: {}", std::string(ret->error_message()));
276-
delete ret;
277-
throw std::runtime_error(err_msg);
278-
}
279-
}
280-
else
281-
{
282-
// Create directory if it doesn't exist
283-
std::filesystem::create_directories(db_path);
284-
// Setup Atomic database
285-
query_result * ret = query("CREATE DATABASE IF NOT EXISTS default ENGINE = Atomic; USE default");
286-
if (ret->has_error())
287-
{
288-
auto err_msg = fmt::format("Failed to create database: {}", std::string(ret->error_message()));
289-
delete ret;
290-
throw std::runtime_error(err_msg);
291-
}
292-
}
293-
}
294-
295263
connection_wrapper::connection_wrapper(const std::string & conn_str)
296264
{
297265
auto [path, params] = parse_connection_string(conn_str);
@@ -307,7 +275,6 @@ connection_wrapper::connection_wrapper(const std::string & conn_str)
307275
conn = connect_chdb(argv_char.size(), argv_char.data());
308276
db_path = path;
309277
is_memory_db = (path == ":memory:");
310-
initialize_database();
311278
}
312279

313280
connection_wrapper::~connection_wrapper()

programs/local/LocalChdb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class connection_wrapper
4646
// Move the private methods declarations here
4747
std::pair<std::string, std::map<std::string, std::string>> parse_connection_string(const std::string & conn_str);
4848
std::vector<std::string> build_clickhouse_args(const std::string & path, const std::map<std::string, std::string> & params);
49-
void initialize_database();
5049
};
5150

5251
class local_result_wrapper

0 commit comments

Comments
 (0)