MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / getCreateQueryFromMetadata

Method getCreateQueryFromMetadata

src/Databases/DatabaseBackup.cpp:398–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398ASTPtr DatabaseBackup::getCreateQueryFromMetadata(const String & table_name, bool throw_on_error) const
399{
400 std::lock_guard lock{table_name_to_create_query_mutex};
401
402 auto it = table_name_to_create_query.find(table_name);
403 if (it == table_name_to_create_query.end())
404 {
405 if (throw_on_error)
406 throw Exception(ErrorCodes::CANNOT_GET_CREATE_TABLE_QUERY, "Table {} does not exist", table_name);
407
408 return {};
409 }
410
411 auto create_query = it->second->clone();
412
413 auto & create_query_typed = create_query->as<ASTCreateQuery &>();
414 create_query_typed.attach = false;
415 create_query_typed.setDatabase(getDatabaseName());
416
417 return create_query;
418}
419
420ASTPtr DatabaseBackup::getCreateDatabaseQueryImpl() const
421{

Callers

nothing calls this directly

Calls 5

ExceptionClass · 0.50
findMethod · 0.45
endMethod · 0.45
cloneMethod · 0.45
setDatabaseMethod · 0.45

Tested by

no test coverage detected