OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InternalCatalogDataWrapper.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #include <regex>
20 
21 #include "Catalog/Catalog.h"
22 #include "Catalog/SysCatalog.h"
23 #include "FsiChunkUtils.h"
24 #include "FsiJsonUtils.h"
25 #include "ImportExport/Importer.h"
26 #include "Shared/StringTransform.h"
27 #include "Shared/SysDefinitions.h"
28 #include "Shared/distributed.h"
29 
30 namespace foreign_storage {
32 
34  const ForeignTable* foreign_table)
35  : InternalSystemDataWrapper(db_id, foreign_table) {}
36 
37 namespace {
39  import_buffer->add_value(import_buffer->getColumnDesc(), "", true, {});
40 }
41 
43  const std::list<Catalog_Namespace::UserMetadata>& all_users,
44  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
45  for (const auto& user : all_users) {
46  if (import_buffers.find("user_id") != import_buffers.end()) {
47  import_buffers["user_id"]->addInt(user.userId);
48  }
49  if (import_buffers.find("user_name") != import_buffers.end()) {
50  import_buffers["user_name"]->addString(user.userName);
51  }
52  if (import_buffers.find("is_super_user") != import_buffers.end()) {
53  import_buffers["is_super_user"]->addBoolean(user.isSuper);
54  }
55  if (import_buffers.find("default_db_id") != import_buffers.end()) {
56  import_buffers["default_db_id"]->addInt(user.defaultDbId);
57  }
58  if (import_buffers.find("default_db_name") != import_buffers.end()) {
59  if (user.defaultDbId > 0) {
60  import_buffers["default_db_name"]->addString(get_db_name(user.defaultDbId));
61  } else {
62  set_null(import_buffers["default_db_name"]);
63  }
64  }
65  if (import_buffers.find("can_login") != import_buffers.end()) {
66  import_buffers["can_login"]->addBoolean(user.can_login);
67  }
68  }
69 }
70 
71 std::string get_user_name(int32_t user_id) {
72  Catalog_Namespace::UserMetadata user_metadata;
73  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
74  if (sys_catalog.getMetadataForUserById(user_id, user_metadata)) {
75  return user_metadata.userName;
76  } else {
77  // User has been deleted.
79  }
80 }
81 
82 std::string get_table_type(const TableDescriptor& td) {
83  std::string table_type{"DEFAULT"};
84  if (td.isView) {
85  table_type = "VIEW";
86  } else if (td.isTemporaryTable()) {
87  table_type = "TEMPORARY";
88  } else if (td.isForeignTable()) {
89  table_type = "FOREIGN";
90  }
91  return table_type;
92 }
93 
94 std::string get_table_ddl(int32_t db_id, const TableDescriptor& td) {
96  CHECK(catalog);
97  auto ddl = catalog->dumpCreateTable(td.tableId);
98  if (!ddl.has_value()) {
99  // It is possible for the table to be concurrently deleted while querying the system
100  // table.
101  return kDeletedValueIndicator;
102  }
103  return ddl.value();
104 }
105 
107  const std::map<int32_t, std::vector<TableDescriptor>>& tables_by_database,
108  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
109  for (const auto& [db_id, tables] : tables_by_database) {
110  for (const auto& table : tables) {
111  if (import_buffers.find("database_id") != import_buffers.end()) {
112  import_buffers["database_id"]->addInt(db_id);
113  }
114  if (import_buffers.find("database_name") != import_buffers.end()) {
115  import_buffers["database_name"]->addString(get_db_name(db_id));
116  }
117  if (import_buffers.find("table_id") != import_buffers.end()) {
118  import_buffers["table_id"]->addInt(table.tableId);
119  }
120  if (import_buffers.find("table_name") != import_buffers.end()) {
121  import_buffers["table_name"]->addString(table.tableName);
122  }
123  if (import_buffers.find("owner_id") != import_buffers.end()) {
124  import_buffers["owner_id"]->addInt(table.userId);
125  }
126  if (import_buffers.find("owner_user_name") != import_buffers.end()) {
127  import_buffers["owner_user_name"]->addString(get_user_name(table.userId));
128  }
129  if (import_buffers.find("column_count") != import_buffers.end()) {
130  import_buffers["column_count"]->addInt(table.nColumns);
131  }
132  if (import_buffers.find("table_type") != import_buffers.end()) {
133  import_buffers["table_type"]->addString(get_table_type(table));
134  }
135  if (import_buffers.find("view_sql") != import_buffers.end()) {
136  import_buffers["view_sql"]->addString(table.viewSQL);
137  }
138  if (import_buffers.find("max_fragment_size") != import_buffers.end()) {
139  import_buffers["max_fragment_size"]->addInt(table.maxFragRows);
140  }
141  if (import_buffers.find("max_chunk_size") != import_buffers.end()) {
142  import_buffers["max_chunk_size"]->addBigint(table.maxChunkSize);
143  }
144  if (import_buffers.find("fragment_page_size") != import_buffers.end()) {
145  import_buffers["fragment_page_size"]->addInt(table.fragPageSize);
146  }
147  if (import_buffers.find("max_rows") != import_buffers.end()) {
148  import_buffers["max_rows"]->addBigint(table.maxRows);
149  }
150  if (import_buffers.find("max_rollback_epochs") != import_buffers.end()) {
151  import_buffers["max_rollback_epochs"]->addInt(table.maxRollbackEpochs);
152  }
153  if (import_buffers.find("shard_count") != import_buffers.end()) {
154  import_buffers["shard_count"]->addInt(table.nShards);
155  }
156  if (import_buffers.find("ddl_statement") != import_buffers.end()) {
157  import_buffers["ddl_statement"]->addString(get_table_ddl(db_id, table));
158  }
159  }
160  }
161 }
162 
163 std::vector<std::string> get_data_sources(const std::string& dashboard_metadata) {
164  rapidjson::Document document;
165  document.Parse(dashboard_metadata);
166  if (!document.IsObject()) {
167  return {};
168  }
169  auto data_sources_str =
171  std::vector<std::string> data_sources;
172  if (data_sources_str.has_value()) {
173  data_sources = split(data_sources_str.value(), ",");
174  for (auto it = data_sources.begin(); it != data_sources.end();) {
175  *it = strip(*it);
176  static std::regex parameter_regex{"\\$\\{.+\\}"};
177  if (std::regex_match(*it, parameter_regex)) {
178  // Remove custom SQL sources.
179  it = data_sources.erase(it);
180  } else {
181  it++;
182  }
183  }
184  }
185  return data_sources;
186 }
187 
189  const std::map<int32_t, std::vector<DashboardDescriptor>>& dashboards_by_database,
190  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
191  for (const auto& [db_id, dashboards] : dashboards_by_database) {
192  for (const auto& dashboard : dashboards) {
193  if (import_buffers.find("database_id") != import_buffers.end()) {
194  import_buffers["database_id"]->addInt(db_id);
195  }
196  if (import_buffers.find("database_name") != import_buffers.end()) {
197  import_buffers["database_name"]->addString(get_db_name(db_id));
198  }
199  if (import_buffers.find("dashboard_id") != import_buffers.end()) {
200  import_buffers["dashboard_id"]->addInt(dashboard.dashboardId);
201  }
202  if (import_buffers.find("dashboard_name") != import_buffers.end()) {
203  import_buffers["dashboard_name"]->addString(dashboard.dashboardName);
204  }
205  if (import_buffers.find("owner_id") != import_buffers.end()) {
206  import_buffers["owner_id"]->addInt(dashboard.userId);
207  }
208  if (import_buffers.find("owner_user_name") != import_buffers.end()) {
209  import_buffers["owner_user_name"]->addString(get_user_name(dashboard.userId));
210  }
211  if (import_buffers.find("last_updated_at") != import_buffers.end()) {
212  auto& buffer = import_buffers["last_updated_at"];
213  import_buffers["last_updated_at"]->add_value(
214  buffer->getColumnDesc(), dashboard.updateTime, false, {});
215  }
216  if (import_buffers.find("data_sources") != import_buffers.end()) {
217  import_buffers["data_sources"]->addStringArray(
218  get_data_sources(dashboard.dashboardMetadata));
219  }
220  }
221  }
222 }
223 
224 std::vector<std::string> get_permissions(const AccessPrivileges privileges,
225  int32_t object_type,
226  int32_t object_id) {
227  std::vector<std::string> permissions;
228  auto type = static_cast<DBObjectType>(object_type);
231  permissions.emplace_back("all");
232  } else {
234  permissions.emplace_back("view_sql_editor");
235  }
237  permissions.emplace_back("access");
238  }
239  }
240  } else if (type == DBObjectType::TableDBObjectType) {
242  permissions.emplace_back("all");
243  } else {
244  std::string suffix;
245  if (object_id == -1) {
246  suffix = " table";
247  }
249  permissions.emplace_back("select" + suffix);
250  }
252  permissions.emplace_back("insert" + suffix);
253  }
255  permissions.emplace_back("update" + suffix);
256  }
258  permissions.emplace_back("delete" + suffix);
259  }
261  permissions.emplace_back("truncate" + suffix);
262  }
264  permissions.emplace_back("alter" + suffix);
265  }
267  permissions.emplace_back("drop" + suffix);
268  }
270  permissions.emplace_back("create table");
271  }
272  }
275  permissions.emplace_back("all");
276  } else {
277  std::string suffix;
278  if (object_id == -1) {
279  suffix = " dashboard";
280  }
282  permissions.emplace_back("view" + suffix);
283  }
285  permissions.emplace_back("edit" + suffix);
286  }
288  permissions.emplace_back("delete" + suffix);
289  }
291  permissions.emplace_back("create dashboard");
292  }
293  }
294  } else if (type == DBObjectType::ViewDBObjectType) {
296  permissions.emplace_back("all");
297  } else {
298  std::string suffix;
299  if (object_id == -1) {
300  suffix = " view";
301  }
303  permissions.emplace_back("select" + suffix);
304  }
306  permissions.emplace_back("drop" + suffix);
307  }
309  permissions.emplace_back("create view");
310  }
311  }
312  } else if (type == DBObjectType::ServerDBObjectType) {
314  permissions.emplace_back("all");
315  } else {
316  std::string suffix;
317  if (object_id == -1) {
318  suffix = " server";
319  }
321  permissions.emplace_back("alter" + suffix);
322  }
324  permissions.emplace_back("usage" + suffix);
325  }
327  permissions.emplace_back("drop" + suffix);
328  }
330  permissions.emplace_back("create server");
331  }
332  }
333  } else {
334  UNREACHABLE() << "Unexpected object type: " << object_type;
335  }
336  return permissions;
337 }
338 
339 std::string get_object_type_str(int32_t object_type) {
340  std::string object_type_str;
341  auto type = static_cast<DBObjectType>(object_type);
343  object_type_str = "database";
344  } else if (type == DBObjectType::TableDBObjectType) {
345  object_type_str = "table";
347  object_type_str = "dashboard";
348  } else if (type == DBObjectType::ViewDBObjectType) {
349  object_type_str = "view";
350  } else if (type == DBObjectType::ServerDBObjectType) {
351  object_type_str = "server";
352  } else {
353  UNREACHABLE() << "Unexpected object type: " << object_type;
354  }
355  return object_type_str;
356 }
357 
359  const std::vector<ObjectRoleDescriptor>& object_permissions,
360  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
361  for (const auto& permission : object_permissions) {
362  if (import_buffers.find("role_name") != import_buffers.end()) {
363  import_buffers["role_name"]->addString(permission.roleName);
364  }
365  if (import_buffers.find("is_user_role") != import_buffers.end()) {
366  import_buffers["is_user_role"]->addBoolean(permission.roleType);
367  }
368  if (import_buffers.find("database_id") != import_buffers.end()) {
369  import_buffers["database_id"]->addInt(permission.dbId);
370  }
371  if (import_buffers.find("database_name") != import_buffers.end()) {
372  import_buffers["database_name"]->addString(get_db_name(permission.dbId));
373  }
374  if (import_buffers.find("object_name") != import_buffers.end()) {
375  import_buffers["object_name"]->addString(permission.objectName);
376  }
377  if (import_buffers.find("object_id") != import_buffers.end()) {
378  import_buffers["object_id"]->addInt(permission.objectId);
379  }
380  if (import_buffers.find("object_owner_id") != import_buffers.end()) {
381  import_buffers["object_owner_id"]->addInt(permission.objectOwnerId);
382  }
383  if (import_buffers.find("object_owner_user_name") != import_buffers.end()) {
384  import_buffers["object_owner_user_name"]->addString(
385  get_user_name(permission.objectOwnerId));
386  }
387  if (import_buffers.find("object_permission_type") != import_buffers.end()) {
388  import_buffers["object_permission_type"]->addString(
389  get_object_type_str(permission.objectType));
390  }
391  if (import_buffers.find("object_permissions") != import_buffers.end()) {
392  auto permissions =
393  get_permissions(permission.privs, permission.objectType, permission.objectId);
394  import_buffers["object_permissions"]->addStringArray(permissions);
395  }
396  }
397 }
398 
400  const std::list<Catalog_Namespace::DBMetadata>& databases,
401  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
402  for (const auto& db : databases) {
403  if (import_buffers.find("database_id") != import_buffers.end()) {
404  import_buffers["database_id"]->addInt(db.dbId);
405  }
406  if (import_buffers.find("database_name") != import_buffers.end()) {
407  import_buffers["database_name"]->addString(db.dbName);
408  }
409  if (import_buffers.find("owner_id") != import_buffers.end()) {
410  import_buffers["owner_id"]->addInt(db.dbOwner);
411  }
412  if (import_buffers.find("owner_user_name") != import_buffers.end()) {
413  import_buffers["owner_user_name"]->addString(get_user_name(db.dbOwner));
414  }
415  }
416 }
417 
419  const std::set<std::string>& roles,
420  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
421  for (const auto& role : roles) {
422  CHECK(import_buffers.find("role_name") != import_buffers.end());
423  import_buffers["role_name"]->addString(role);
424  }
425 }
426 
428  const std::map<std::string, std::vector<std::string>>& user_names_by_role_,
429  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
430  for (const auto& [role, user_names] : user_names_by_role_) {
431  for (const auto& user_name : user_names) {
432  if (import_buffers.find("role_name") != import_buffers.end()) {
433  import_buffers["role_name"]->addString(role);
434  }
435  if (import_buffers.find("user_name") != import_buffers.end()) {
436  import_buffers["user_name"]->addString(user_name);
437  }
438  }
439  }
440 }
441 
442 std::map<int32_t, std::vector<TableDescriptor>> get_all_tables() {
443  std::map<int32_t, std::vector<TableDescriptor>> tables_by_database;
444  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
445  for (const auto& catalog : sys_catalog.getCatalogsForAllDbs()) {
446  if (catalog->name() != shared::kInfoSchemaDbName) {
447  for (const auto& td : catalog->getAllTableMetadataCopy()) {
448  tables_by_database[catalog->getDatabaseId()].emplace_back(td);
449  }
450  }
451  }
452  return tables_by_database;
453 }
454 
455 std::map<int32_t, std::vector<DashboardDescriptor>> get_all_dashboards() {
456  std::map<int32_t, std::vector<DashboardDescriptor>> dashboards_by_database;
457  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
458  for (const auto& catalog : sys_catalog.getCatalogsForAllDbs()) {
459  if (catalog->name() != shared::kInfoSchemaDbName) {
460  for (const auto& dashboard : catalog->getAllDashboardsMetadataCopy()) {
461  dashboards_by_database[catalog->getDatabaseId()].emplace_back(dashboard);
462  }
463  }
464  }
465  return dashboards_by_database;
466 }
467 
468 std::map<std::string, std::vector<std::string>> get_all_role_assignments() {
469  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
470  const auto& users = sys_catalog.getAllUserMetadata();
471  std::map<std::string, std::vector<std::string>> user_names_by_role;
472  for (const auto& user : users) {
473  for (const auto& role :
474  sys_catalog.getRoles(false, user.isSuper, user.userName, true)) {
475  user_names_by_role[role].emplace_back(user.userName);
476  }
477  }
478  return user_names_by_role;
479 }
480 } // namespace
481 
483  const std::string& table_name) {
484  row_count_ = 0;
485 
486  // Dashboads are handled separately since they are only on the aggregator in
487  // distributed. All others are only on the first leaf.
490  // Only the aggregator can contain dashboards in distributed.
491  return;
492  }
493  dashboards_by_database_.clear();
495  for (const auto& [db_id, dashboards] : dashboards_by_database_) {
496  row_count_ += dashboards.size();
497  }
498  return;
499  }
500 
502  // For every table except dashboards, only the first leaf returns information in
503  // distributed.
504  return;
505  }
506  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
508  users_.clear();
509  users_ = sys_catalog.getAllUserMetadata();
510  row_count_ = users_.size();
512  tables_by_database_.clear();
514  for (const auto& [db_id, tables] : tables_by_database_) {
515  row_count_ += tables.size();
516  }
518  object_permissions_.clear();
519  object_permissions_ = sys_catalog.getMetadataForAllObjects();
522  databases_.clear();
523  databases_ = sys_catalog.getAllDBMetadata();
524  row_count_ = databases_.size();
526  roles_.clear();
527  roles_ = sys_catalog.getCreatedRoles();
528  row_count_ = roles_.size();
529  } else if (foreign_table_->tableName ==
531  user_names_by_role_.clear();
533  for (const auto& [role, user_names] : user_names_by_role_) {
534  row_count_ += user_names.size();
535  }
536  } else {
537  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
538  }
539 }
540 
542  const std::string& table_name,
543  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
550  import_buffers);
557  } else if (foreign_table_->tableName ==
560  import_buffers);
561  } else {
562  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
563  }
564 }
565 } // namespace foreign_storage
static const AccessPrivileges VIEW_SQL_EDITOR
Definition: DBObject.h:152
static const AccessPrivileges VIEW_DASHBOARD
Definition: DBObject.h:171
bool is_first_leaf()
Definition: distributed.cpp:25
static const AccessPrivileges DROP_SERVER
Definition: DBObject.h:189
std::vector< std::string > get_data_sources(const std::string &dashboard_metadata)
std::string tableName
static const AccessPrivileges ALL_DATABASE
Definition: DBObject.h:151
static const AccessPrivileges ALTER_TABLE
Definition: DBObject.h:165
DBObjectType
Definition: DBObject.h:40
std::string get_table_ddl(int32_t db_id, const TableDescriptor &td)
std::vector< std::string > get_permissions(const AccessPrivileges privileges, int32_t object_type, int32_t object_id)
static const AccessPrivileges TRUNCATE_TABLE
Definition: DBObject.h:164
std::string strip(std::string_view str)
trim any whitespace from the left and right ends of a string
static constexpr const char * DASHBOARDS_SYS_TABLE_NAME
Definition: Catalog.h:106
constexpr const char * kDeletedValueIndicator
std::map< int32_t, std::vector< DashboardDescriptor > > get_all_dashboards()
void populate_import_buffers_for_catalog_dashboards(const std::map< int32_t, std::vector< DashboardDescriptor >> &dashboards_by_database, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
static const AccessPrivileges INSERT_INTO_TABLE
Definition: DBObject.h:161
static const AccessPrivileges CREATE_DASHBOARD
Definition: DBObject.h:170
static const AccessPrivileges SERVER_USAGE
Definition: DBObject.h:191
#define UNREACHABLE()
Definition: Logger.h:266
void populateChunkBuffersForTable(const std::string &table_name, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers) override
const std::string kInfoSchemaDbName
bool isForeignTable() const
static const AccessPrivileges SELECT_FROM_TABLE
Definition: DBObject.h:160
std::string suffix(SQLTypes type)
Definition: Codegen.cpp:68
std::vector< std::string > split(std::string_view str, std::string_view delim, std::optional< size_t > maxsplit)
split apart a string into a vector of substrings
static const AccessPrivileges ALL_VIEW
Definition: DBObject.h:177
std::vector< ObjectRoleDescriptor > object_permissions_
static const AccessPrivileges ALTER_SERVER
Definition: DBObject.h:190
This file contains the class specification and related data structures for Catalog.
static constexpr const char * ROLES_SYS_TABLE_NAME
Definition: Catalog.h:109
static SysCatalog & instance()
Definition: SysCatalog.h:341
This file contains the class specification and related data structures for SysCatalog.
static const AccessPrivileges DROP_TABLE
Definition: DBObject.h:159
void populate_import_buffers_for_catalog_permissions(const std::vector< ObjectRoleDescriptor > &object_permissions, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
void populate_import_buffers_for_catalog_tables(const std::map< int32_t, std::vector< TableDescriptor >> &tables_by_database, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
CONSTEXPR DEVICE void set_null(T &value)
std::list< Catalog_Namespace::UserMetadata > users_
void populate_import_buffers_for_catalog_role_assignments(const std::map< std::string, std::vector< std::string >> &user_names_by_role_, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
static const AccessPrivileges ALL_SERVER
Definition: DBObject.h:187
static const AccessPrivileges CREATE_SERVER
Definition: DBObject.h:188
std::map< int32_t, std::vector< TableDescriptor > > get_all_tables()
static const AccessPrivileges DELETE_FROM_TABLE
Definition: DBObject.h:163
static constexpr const char * ROLE_ASSIGNMENTS_SYS_TABLE_NAME
Definition: Catalog.h:110
static const AccessPrivileges CREATE_TABLE
Definition: DBObject.h:158
static constexpr const char * USERS_SYS_TABLE_NAME
Definition: Catalog.h:104
std::optional< std::string > get_optional_string_value_from_object(const rapidjson::Value &object, const std::string &key)
static constexpr const char * DATABASES_SYS_TABLE_NAME
Definition: Catalog.h:107
std::list< Catalog_Namespace::DBMetadata > databases_
std::shared_ptr< Catalog > getCatalog(const std::string &dbName)
static constexpr const char * TABLES_SYS_TABLE_NAME
Definition: Catalog.h:105
bool is_aggregator()
Definition: distributed.cpp:33
void populate_import_buffers_for_catalog_databases(const std::list< Catalog_Namespace::DBMetadata > &databases, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
bool isTemporaryTable() const
static const AccessPrivileges SELECT_FROM_VIEW
Definition: DBObject.h:180
static constexpr const char * PERMISSIONS_SYS_TABLE_NAME
Definition: Catalog.h:108
std::map< std::string, std::vector< std::string > > get_all_role_assignments()
static const AccessPrivileges ALL_DASHBOARD
Definition: DBObject.h:169
static const AccessPrivileges ACCESS
Definition: DBObject.h:153
static const AccessPrivileges ALL_TABLE
Definition: DBObject.h:157
void populate_import_buffers_for_catalog_users(const std::list< Catalog_Namespace::UserMetadata > &all_users, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
static const AccessPrivileges DROP_VIEW
Definition: DBObject.h:179
#define CHECK(condition)
Definition: Logger.h:222
static const AccessPrivileges CREATE_VIEW
Definition: DBObject.h:178
std::string get_db_name(int32_t db_id)
const ColumnDescriptor * getColumnDesc() const
Definition: Importer.h:319
std::map< std::string, std::vector< std::string > > user_names_by_role_
static const AccessPrivileges DELETE_DASHBOARD
Definition: DBObject.h:173
int64_t privileges
Definition: DBObject.h:133
std::map< int32_t, std::vector< TableDescriptor > > tables_by_database_
void populate_import_buffers_for_catalog_roles(const std::set< std::string > &roles, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
static const AccessPrivileges EDIT_DASHBOARD
Definition: DBObject.h:172
static const AccessPrivileges UPDATE_IN_TABLE
Definition: DBObject.h:162
bool hasPermission(int permission) const
Definition: DBObject.h:141
std::map< int32_t, std::vector< DashboardDescriptor > > dashboards_by_database_
void add_value(const ColumnDescriptor *cd, const std::string_view val, const bool is_null, const CopyParams &copy_params, const bool check_not_null=true)
Definition: Importer.cpp:567
bool is_distributed()
Definition: distributed.cpp:21
void initializeObjectsForTable(const std::string &table_name) override