OmniSciDB  a5dc49c757
 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 "ImportExport/Importer.h"
25 #include "Shared/JsonUtils.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"]->addDictStringWithTruncation(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"]->addDictStringWithTruncation(
61  get_db_name(user.defaultDbId));
62  } else {
63  set_null(import_buffers["default_db_name"]);
64  }
65  }
66  if (import_buffers.find("can_login") != import_buffers.end()) {
67  import_buffers["can_login"]->addBoolean(user.can_login);
68  }
69  }
70 }
71 
72 std::string get_user_name(int32_t user_id) {
73  Catalog_Namespace::UserMetadata user_metadata;
74  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
75  if (sys_catalog.getMetadataForUserById(user_id, user_metadata)) {
76  return user_metadata.userName;
77  } else {
78  // User has been deleted.
80  }
81 }
82 
83 std::string get_table_type(const TableDescriptor& td) {
84  std::string table_type{"DEFAULT"};
85  if (td.isView) {
86  table_type = "VIEW";
87  } else if (td.isTemporaryTable()) {
88  table_type = "TEMPORARY";
89  } else if (td.isForeignTable()) {
90  table_type = "FOREIGN";
91  }
92  return table_type;
93 }
94 
95 std::string get_table_ddl(int32_t db_id, const TableDescriptor& td) {
97  CHECK(catalog);
98  auto ddl = catalog->dumpCreateTable(td.tableId);
99  if (!ddl.has_value()) {
100  // It is possible for the table to be concurrently deleted while querying the system
101  // table.
102  return kDeletedValueIndicator;
103  }
104  return ddl.value();
105 }
106 
108  const std::map<int32_t, std::vector<TableDescriptor>>& tables_by_database,
109  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
110  for (const auto& [db_id, tables] : tables_by_database) {
111  for (const auto& table : tables) {
112  if (import_buffers.find("database_id") != import_buffers.end()) {
113  import_buffers["database_id"]->addInt(db_id);
114  }
115  if (import_buffers.find("database_name") != import_buffers.end()) {
116  import_buffers["database_name"]->addDictStringWithTruncation(get_db_name(db_id));
117  }
118  if (import_buffers.find("table_id") != import_buffers.end()) {
119  import_buffers["table_id"]->addInt(table.tableId);
120  }
121  if (import_buffers.find("table_name") != import_buffers.end()) {
122  import_buffers["table_name"]->addDictStringWithTruncation(table.tableName);
123  }
124  if (import_buffers.find("owner_id") != import_buffers.end()) {
125  import_buffers["owner_id"]->addInt(table.userId);
126  }
127  if (import_buffers.find("owner_user_name") != import_buffers.end()) {
128  import_buffers["owner_user_name"]->addDictStringWithTruncation(
129  get_user_name(table.userId));
130  }
131  if (import_buffers.find("column_count") != import_buffers.end()) {
132  import_buffers["column_count"]->addInt(table.nColumns);
133  }
134  if (import_buffers.find("table_type") != import_buffers.end()) {
135  import_buffers["table_type"]->addDictStringWithTruncation(get_table_type(table));
136  }
137  if (import_buffers.find("view_sql") != import_buffers.end()) {
138  import_buffers["view_sql"]->addDictStringWithTruncation(table.viewSQL);
139  }
140  if (import_buffers.find("max_fragment_size") != import_buffers.end()) {
141  import_buffers["max_fragment_size"]->addInt(table.maxFragRows);
142  }
143  if (import_buffers.find("max_chunk_size") != import_buffers.end()) {
144  import_buffers["max_chunk_size"]->addBigint(table.maxChunkSize);
145  }
146  if (import_buffers.find("fragment_page_size") != import_buffers.end()) {
147  import_buffers["fragment_page_size"]->addInt(table.fragPageSize);
148  }
149  if (import_buffers.find("max_rows") != import_buffers.end()) {
150  import_buffers["max_rows"]->addBigint(table.maxRows);
151  }
152  if (import_buffers.find("max_rollback_epochs") != import_buffers.end()) {
153  import_buffers["max_rollback_epochs"]->addInt(table.maxRollbackEpochs);
154  }
155  if (import_buffers.find("shard_count") != import_buffers.end()) {
156  import_buffers["shard_count"]->addInt(table.nShards);
157  }
158  if (import_buffers.find("ddl_statement") != import_buffers.end()) {
159  import_buffers["ddl_statement"]->addDictStringWithTruncation(
160  get_table_ddl(db_id, table));
161  }
162  }
163  }
164 }
165 
166 std::vector<std::string> get_data_sources(const std::string& dashboard_metadata) {
167  rapidjson::Document document;
168  document.Parse(dashboard_metadata);
169  if (!document.IsObject()) {
170  return {};
171  }
172  auto data_sources_str =
174  std::vector<std::string> data_sources;
175  if (data_sources_str.has_value()) {
176  data_sources = split(data_sources_str.value(), ",");
177  for (auto it = data_sources.begin(); it != data_sources.end();) {
178  *it = strip(*it);
179  static std::regex parameter_regex{"\\$\\{.+\\}"};
180  if (std::regex_match(*it, parameter_regex)) {
181  // Remove custom SQL sources.
182  it = data_sources.erase(it);
183  } else {
184  it++;
185  }
186  }
187  }
188  return data_sources;
189 }
190 
192  const std::map<int32_t, std::vector<DashboardDescriptor>>& dashboards_by_database,
193  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
194  for (const auto& [db_id, dashboards] : dashboards_by_database) {
195  for (const auto& dashboard : dashboards) {
196  if (import_buffers.find("database_id") != import_buffers.end()) {
197  import_buffers["database_id"]->addInt(db_id);
198  }
199  if (import_buffers.find("database_name") != import_buffers.end()) {
200  import_buffers["database_name"]->addDictStringWithTruncation(get_db_name(db_id));
201  }
202  if (import_buffers.find("dashboard_id") != import_buffers.end()) {
203  import_buffers["dashboard_id"]->addInt(dashboard.dashboardId);
204  }
205  if (import_buffers.find("dashboard_name") != import_buffers.end()) {
206  import_buffers["dashboard_name"]->addDictStringWithTruncation(
207  dashboard.dashboardName);
208  }
209  if (import_buffers.find("owner_id") != import_buffers.end()) {
210  import_buffers["owner_id"]->addInt(dashboard.userId);
211  }
212  if (import_buffers.find("owner_user_name") != import_buffers.end()) {
213  import_buffers["owner_user_name"]->addDictStringWithTruncation(
214  get_user_name(dashboard.userId));
215  }
216  if (import_buffers.find("last_updated_at") != import_buffers.end()) {
217  auto& buffer = import_buffers["last_updated_at"];
218  import_buffers["last_updated_at"]->add_value(
219  buffer->getColumnDesc(), dashboard.updateTime, false, {});
220  }
221  if (import_buffers.find("data_sources") != import_buffers.end()) {
222  import_buffers["data_sources"]->addStringArray(
223  get_data_sources(dashboard.dashboardMetadata));
224  }
225  }
226  }
227 }
228 
229 std::vector<std::string> get_permissions(const AccessPrivileges privileges,
230  int32_t object_type,
231  int32_t object_id) {
232  std::vector<std::string> permissions;
233  auto type = static_cast<DBObjectType>(object_type);
236  permissions.emplace_back("all");
237  } else {
239  permissions.emplace_back("view_sql_editor");
240  }
242  permissions.emplace_back("access");
243  }
244  }
245  } else if (type == DBObjectType::TableDBObjectType) {
247  permissions.emplace_back("all");
248  } else {
249  std::string suffix;
250  if (object_id == -1) {
251  suffix = " table";
252  }
254  permissions.emplace_back("select" + suffix);
255  }
257  permissions.emplace_back("insert" + suffix);
258  }
260  permissions.emplace_back("update" + suffix);
261  }
263  permissions.emplace_back("delete" + suffix);
264  }
266  permissions.emplace_back("truncate" + suffix);
267  }
269  permissions.emplace_back("alter" + suffix);
270  }
272  permissions.emplace_back("drop" + suffix);
273  }
275  permissions.emplace_back("create table");
276  }
277  }
280  permissions.emplace_back("all");
281  } else {
282  std::string suffix;
283  if (object_id == -1) {
284  suffix = " dashboard";
285  }
287  permissions.emplace_back("view" + suffix);
288  }
290  permissions.emplace_back("edit" + suffix);
291  }
293  permissions.emplace_back("delete" + suffix);
294  }
296  permissions.emplace_back("create dashboard");
297  }
298  }
299  } else if (type == DBObjectType::ViewDBObjectType) {
301  permissions.emplace_back("all");
302  } else {
303  std::string suffix;
304  if (object_id == -1) {
305  suffix = " view";
306  }
308  permissions.emplace_back("select" + suffix);
309  }
311  permissions.emplace_back("drop" + suffix);
312  }
314  permissions.emplace_back("create view");
315  }
316  }
317  } else if (type == DBObjectType::ServerDBObjectType) {
319  permissions.emplace_back("all");
320  } else {
321  std::string suffix;
322  if (object_id == -1) {
323  suffix = " server";
324  }
326  permissions.emplace_back("alter" + suffix);
327  }
329  permissions.emplace_back("usage" + suffix);
330  }
332  permissions.emplace_back("drop" + suffix);
333  }
335  permissions.emplace_back("create server");
336  }
337  }
338  } else {
339  UNREACHABLE() << "Unexpected object type: " << object_type;
340  }
341  return permissions;
342 }
343 
344 std::string get_object_type_str(int32_t object_type) {
345  std::string object_type_str;
346  auto type = static_cast<DBObjectType>(object_type);
348  object_type_str = "database";
349  } else if (type == DBObjectType::TableDBObjectType) {
350  object_type_str = "table";
352  object_type_str = "dashboard";
353  } else if (type == DBObjectType::ViewDBObjectType) {
354  object_type_str = "view";
355  } else if (type == DBObjectType::ServerDBObjectType) {
356  object_type_str = "server";
357  } else {
358  UNREACHABLE() << "Unexpected object type: " << object_type;
359  }
360  return object_type_str;
361 }
362 
364  const std::vector<ObjectRoleDescriptor>& object_permissions,
365  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
366  for (const auto& permission : object_permissions) {
367  if (import_buffers.find("role_name") != import_buffers.end()) {
368  import_buffers["role_name"]->addDictStringWithTruncation(permission.roleName);
369  }
370  if (import_buffers.find("is_user_role") != import_buffers.end()) {
371  import_buffers["is_user_role"]->addBoolean(permission.roleType);
372  }
373  if (import_buffers.find("database_id") != import_buffers.end()) {
374  import_buffers["database_id"]->addInt(permission.dbId);
375  }
376  if (import_buffers.find("database_name") != import_buffers.end()) {
377  import_buffers["database_name"]->addDictStringWithTruncation(
378  get_db_name(permission.dbId));
379  }
380  if (import_buffers.find("object_name") != import_buffers.end()) {
381  import_buffers["object_name"]->addDictStringWithTruncation(permission.objectName);
382  }
383  if (import_buffers.find("object_id") != import_buffers.end()) {
384  import_buffers["object_id"]->addInt(permission.objectId);
385  }
386  if (import_buffers.find("object_owner_id") != import_buffers.end()) {
387  import_buffers["object_owner_id"]->addInt(permission.objectOwnerId);
388  }
389  if (import_buffers.find("object_owner_user_name") != import_buffers.end()) {
390  import_buffers["object_owner_user_name"]->addDictStringWithTruncation(
391  get_user_name(permission.objectOwnerId));
392  }
393  if (import_buffers.find("object_permission_type") != import_buffers.end()) {
394  import_buffers["object_permission_type"]->addDictStringWithTruncation(
395  get_object_type_str(permission.objectType));
396  }
397  if (import_buffers.find("object_permissions") != import_buffers.end()) {
398  auto permissions =
399  get_permissions(permission.privs, permission.objectType, permission.objectId);
400  import_buffers["object_permissions"]->addStringArray(permissions);
401  }
402  }
403 }
404 
406  const std::list<Catalog_Namespace::DBMetadata>& databases,
407  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
408  for (const auto& db : databases) {
409  if (import_buffers.find("database_id") != import_buffers.end()) {
410  import_buffers["database_id"]->addInt(db.dbId);
411  }
412  if (import_buffers.find("database_name") != import_buffers.end()) {
413  import_buffers["database_name"]->addDictStringWithTruncation(db.dbName);
414  }
415  if (import_buffers.find("owner_id") != import_buffers.end()) {
416  import_buffers["owner_id"]->addInt(db.dbOwner);
417  }
418  if (import_buffers.find("owner_user_name") != import_buffers.end()) {
419  import_buffers["owner_user_name"]->addDictStringWithTruncation(
420  get_user_name(db.dbOwner));
421  }
422  }
423 }
424 
426  const std::set<std::string>& roles,
427  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
428  for (const auto& role : roles) {
429  CHECK(import_buffers.find("role_name") != import_buffers.end());
430  import_buffers["role_name"]->addDictStringWithTruncation(role);
431  }
432 }
433 
435  const std::map<std::string, std::vector<std::string>>& user_names_by_role_,
436  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
437  for (const auto& [role, user_names] : user_names_by_role_) {
438  for (const auto& user_name : user_names) {
439  if (import_buffers.find("role_name") != import_buffers.end()) {
440  import_buffers["role_name"]->addDictStringWithTruncation(role);
441  }
442  if (import_buffers.find("user_name") != import_buffers.end()) {
443  import_buffers["user_name"]->addDictStringWithTruncation(user_name);
444  }
445  }
446  }
447 }
448 
449 std::map<int32_t, std::vector<TableDescriptor>> get_all_tables() {
450  std::map<int32_t, std::vector<TableDescriptor>> tables_by_database;
451  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
452  for (const auto& catalog : sys_catalog.getCatalogsForAllDbs()) {
453  if (catalog->name() != shared::kInfoSchemaDbName) {
454  for (const auto& td : catalog->getAllTableMetadataCopy()) {
455  tables_by_database[catalog->getDatabaseId()].emplace_back(td);
456  }
457  }
458  }
459  return tables_by_database;
460 }
461 
462 std::map<int32_t, std::vector<DashboardDescriptor>> get_all_dashboards() {
463  std::map<int32_t, std::vector<DashboardDescriptor>> dashboards_by_database;
464  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
465  for (const auto& catalog : sys_catalog.getCatalogsForAllDbs()) {
466  if (catalog->name() != shared::kInfoSchemaDbName) {
467  for (const auto& dashboard : catalog->getAllDashboardsMetadataForSysTable()) {
468  dashboards_by_database[catalog->getDatabaseId()].emplace_back(dashboard);
469  }
470  }
471  }
472  return dashboards_by_database;
473 }
474 
475 std::map<std::string, std::vector<std::string>> get_all_role_assignments() {
476  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
477  const auto& users = sys_catalog.getAllUserMetadata();
478  std::map<std::string, std::vector<std::string>> user_names_by_role;
479  for (const auto& user : users) {
480  for (const auto& role :
481  sys_catalog.getRoles(false, user.isSuper, user.userName, true)) {
482  user_names_by_role[role].emplace_back(user.userName);
483  }
484  }
485  return user_names_by_role;
486 }
487 } // namespace
488 
490  const std::string& table_name) {
491  row_count_ = 0;
492 
493  // Dashboads are handled separately since they are only on the aggregator in
494  // distributed. All others are only on the first leaf.
497  // Only the aggregator can contain dashboards in distributed.
498  return;
499  }
500  dashboards_by_database_.clear();
502  for (const auto& [db_id, dashboards] : dashboards_by_database_) {
503  row_count_ += dashboards.size();
504  }
505  return;
506  }
507 
509  // For every table except dashboards, only the first leaf returns information in
510  // distributed.
511  return;
512  }
513  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
515  users_.clear();
516  users_ = sys_catalog.getAllUserMetadata();
517  row_count_ = users_.size();
519  tables_by_database_.clear();
521  for (const auto& [db_id, tables] : tables_by_database_) {
522  row_count_ += tables.size();
523  }
525  object_permissions_.clear();
526  object_permissions_ = sys_catalog.getMetadataForAllObjects();
529  databases_.clear();
530  databases_ = sys_catalog.getAllDBMetadata();
531  row_count_ = databases_.size();
533  roles_.clear();
534  roles_ = sys_catalog.getCreatedRoles();
535  row_count_ = roles_.size();
536  } else if (foreign_table_->tableName ==
538  user_names_by_role_.clear();
540  for (const auto& [role, user_names] : user_names_by_role_) {
541  row_count_ += user_names.size();
542  }
543  } else {
544  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
545  }
546 }
547 
549  const std::string& table_name,
550  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) {
557  import_buffers);
564  } else if (foreign_table_->tableName ==
567  import_buffers);
568  } else {
569  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
570  }
571 }
572 } // 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:114
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:338
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:75
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:117
static SysCatalog & instance()
Definition: SysCatalog.h:343
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::optional< std::string > get_optional_string_value_from_object(const rapidjson::Value &object, const std::string &key)
Definition: JsonUtils.cpp:232
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:118
static const AccessPrivileges CREATE_TABLE
Definition: DBObject.h:158
static constexpr const char * USERS_SYS_TABLE_NAME
Definition: Catalog.h:112
static constexpr const char * DATABASES_SYS_TABLE_NAME
Definition: Catalog.h:115
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:113
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:116
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:291
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:325
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:529
bool is_distributed()
Definition: distributed.cpp:21
void initializeObjectsForTable(const std::string &table_name) override