예제 #1
0
 @Override
 public void create(QualifiedName name, DatabaseDto dto) {
   Session session = validateAndGetSession(name);
   log.info("Creating schema {}", name);
   metadataManager.createSchema(session, new ConnectorSchemaMetadata(name.getDatabaseName()));
   if (dto != null && dto.getDefinitionMetadata() != null) {
     log.info("Saving user metadata for schema {}", name);
     userMetadataService.saveDefinitionMetadata(
         name, session.getUser(), Optional.of(dto.getDefinitionMetadata()), true);
   }
 }
예제 #2
0
 @Override
 public void update(QualifiedName name, DatabaseDto dto) {
   Session session = validateAndGetSession(name);
   log.info("Updating schema {}", name);
   try {
     metadataManager.updateSchema(session, new ConnectorSchemaMetadata(name.getDatabaseName()));
   } catch (PrestoException e) {
     if (e.getErrorCode() != StandardErrorCode.NOT_SUPPORTED.toErrorCode()) {
       throw e;
     }
   }
   if (dto != null && dto.getDefinitionMetadata() != null) {
     log.info("Saving user metadata for schema {}", name);
     userMetadataService.saveDefinitionMetadata(
         name, session.getUser(), Optional.of(dto.getDefinitionMetadata()), true);
   }
 }