How to use the catalog/dataCatalog.getEntry function in catalog

To help you get started, we’ve selected a few catalog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudera / hue / desktop / core / src / desktop / js / ko / components / ko.historyPanel.js View on Github external
if (val === 'failed') {
              //self.isIndexing(false);
              //self.indexingStarted(false);
              //self.indexingError(true);
            } else if (val === 'available') {
              const snippet = notebook.snippets()[0];
              if (!snippet.result.handle().has_more_statements) {
                // TODO: Show finish notification and clicking on it does onSuccessUrl
                // or if still on initial spinner we redirect automatically to onSuccessUrl
                if (notebook.onSuccessUrl() && notebook.onSuccessUrl() !== 'assist.db.refresh') {
                  // TODO: Similar if in in FB directory, also refresh FB dir
                  huePubSub.publish('open.link', notebook.onSuccessUrl());
                }

                if (notebook.onSuccessUrl() === 'assist.db.refresh') {
                  dataCatalog
                    .getEntry({
                      sourceType: snippet.type(),
                      namespace: snippet.namespace(),
                      compute: snippet.compute(),
                      path: []
                    })
                    .done(entry => {
                      entry.clearCache({ invalidate: 'cache', cascade: true, silenceErrors: true });
                    });
                } else if (notebook.onSuccessUrl()) {
                  huePubSub.publish(notebook.pubSubUrl());
                }
                notebook.close(); // TODO: Don't close when onSuccessUrl is editor?
              } else {
                // Perform last DROP statement execute
                snippet.execute();
github cloudera / hue / desktop / core / src / desktop / js / sql / autocompleteResults.js View on Github external
const fetchFieldsInternal = function(remainingPath, fetchedPath) {
      if (!fetchedPath) {
        fetchedPath = [];
      }
      if (remainingPath.length > 0) {
        fetchedPath.push(remainingPath.shift());
        // Parser sometimes knows if it's a map or array.
        if (
          remainingPath.length > 0 &&
          (remainingPath[0] === 'item' || remainingPath[0].name === 'value')
        ) {
          fetchedPath.push(remainingPath.shift());
        }
      }

      dataCatalog
        .getEntry({
          sourceType: self.snippet.type(),
          namespace: self.snippet.namespace(),
          compute: self.snippet.compute(),
          path: fetchedPath,
          temporaryOnly: self.temporaryOnly
        })
        .done(catalogEntry => {
          self.cancellablePromises.push(
            catalogEntry
              .getSourceMeta({ silenceErrors: true, cancellable: true })
              .done(sourceMeta => {
                if (
                  self.snippet.type() === 'hive' &&
                  typeof sourceMeta.extended_columns !== 'undefined' &&
                  sourceMeta.extended_columns.length === 1 &&
github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / ace / aceLocationHandler.js View on Github external
if (token.parseLocation) {
                const endCoordinates = self.editor.renderer.textToScreenCoordinates(
                  pointerPosition.row,
                  token.start
                );

                let tooltipText =
                  token.parseLocation.type === 'asterisk' ? self.expandStar : self.contextTooltip;
                let colType;
                if (token.parseLocation.type === 'column') {
                  const tableChain = token.parseLocation.identifierChain.concat();
                  const lastIdentifier = tableChain.pop();
                  if (tableChain.length > 0 && lastIdentifier && lastIdentifier.name) {
                    const colName = lastIdentifier.name.toLowerCase();
                    // Note, as cachedOnly is set to true it will call the successCallback right away (or not at all)
                    dataCatalog
                      .getEntry({
                        sourceType: self.snippet.type(),
                        namespace: self.snippet.namespace(),
                        compute: self.snippet.compute(),
                        temporaryOnly: self.snippet.autocompleteSettings.temporaryOnly,
                        path: $.map(tableChain, identifier => {
                          return identifier.name;
                        })
                      })
                      .done(entry => {
                        entry
                          .getSourceMeta({ cachedOnly: true, silenceErrors: true })
                          .done(sourceMeta => {
                            if (sourceMeta && sourceMeta.extended_columns) {
                              sourceMeta.extended_columns.every(col => {
                                if (col.name.toLowerCase() === colName) {
github cloudera / hue / desktop / core / src / desktop / js / ko / components / assist / ko.assistDashboardPanel.js View on Github external
.done(fakeDbCatalogEntry => {
            const assistFakeDb = new AssistDbEntry(
              fakeDbCatalogEntry,
              null,
              assistDbSource,
              this.filter,
              i18n,
              navigationSettings
            );
            dataCatalog
              .getEntry({
                sourceType: sourceType,
                namespace: collection.activeNamespace,
                compute: collection.activeCompute,
                path: [
                  fakeParentName,
                  collectionName.indexOf('.') > -1 ? collectionName.split('.')[1] : collectionName
                ],
                definition: { type: 'table' }
              })
              .done(collectionCatalogEntry => {
                const collectionEntry = new AssistDbEntry(
                  collectionCatalogEntry,
                  assistFakeDb,
                  assistDbSource,
                  this.filter,
github cloudera / hue / desktop / core / src / desktop / js / ko / components / assist / ko.assistDashboardPanel.js View on Github external
i18n: i18n,
          initialNamespace: collection.activeNamespace,
          initialCompute: collection.activeCompute,
          type: collection.engine(),
          name: collection.engine(),
          nonSqlType: true,
          navigationSettings: navigationSettings
        });

        const fakeParentName =
          collectionName.indexOf('.') > -1 ? collectionName.split('.')[0] : 'default';

        const sourceType =
          collection.source() === 'query' ? collection.engine() + '-query' : collection.engine();

        dataCatalog
          .getEntry({
            sourceType: sourceType,
            namespace: collection.activeNamespace,
            compute: collection.activeCompute,
            path: [fakeParentName],
            definition: { type: 'database' }
          })
          .done(fakeDbCatalogEntry => {
            const assistFakeDb = new AssistDbEntry(
              fakeDbCatalogEntry,
              null,
              assistDbSource,
              this.filter,
              i18n,
              navigationSettings
            );
github cloudera / hue / desktop / core / src / desktop / js / sql / sqlUtils.js View on Github external
if (foundEntry && options.identifierChain.length > 1) {
            findInTree(foundEntry, identifierChainToPath(options.identifierChain.slice(1)));
          } else if (foundEntry) {
            deferred.resolve(foundEntry);
          } else {
            findTable(tablesToGo);
          }
        })
        .fail(deferred.reject)
    );
  };

  if (options.tables) {
    findTable(options.tables.concat());
  } else {
    dataCatalog
      .getEntry({
        sourceType: options.sourceType,
        namespace: options.namespace,
        compute: options.compute,
        path: [],
        cachedOnly: options && options.cachedOnly,
        cancellable: options && options.cancellable,
        temporaryOnly: options && options.temporaryOnly,
        silenceErrors: true
      })
      .done(entry => {
        findInTree(entry, identifierChainToPath(options.identifierChain));
      });
  }

  return promise;
github cloudera / hue / desktop / core / src / desktop / js / apps / table_browser / app.js View on Github external
}
        );
      }
    }
  });

  ko.applyBindings(viewModel, $('#metastoreComponents')[0]);

  huePubSub.subscribe('cluster.config.set.config', clusterConfig => {
    viewModel.appConfig(clusterConfig && clusterConfig['app_config']);
  });

  huePubSub.publish('cluster.config.get.config');

  if (location.getParameter('refresh') === 'true') {
    dataCatalog
      .getEntry({
        namespace: viewModel.source().namespace().namespace,
        compute: viewModel.source().namespace().compute,
        sourceType: viewModel.source().type,
        path: [],
        definition: { type: 'source' }
      })
      .done(entry => {
        entry.clearCache({
          invalidate: viewModel.source().type === 'impala' ? 'invalidate' : 'cache',
          silenceErrors: true
        });
        hueUtils.replaceURL('?');
      });
  }
});
github cloudera / hue / desktop / core / src / desktop / js / sql / autocompleteResults.js View on Github external
loadDatabases() {
    const self = this;
    const databasesDeferred = $.Deferred();
    dataCatalog
      .getEntry({
        sourceType: self.snippet.type(),
        namespace: self.snippet.namespace(),
        compute: self.snippet.compute(),
        path: [],
        temporaryOnly: self.temporaryOnly
      })
      .done(entry => {
        self.cancellablePromises.push(
          entry
            .getChildren({ silenceErrors: true, cancellable: true })
            .done(databases => {
              databasesDeferred.resolve(databases);
            })
            .fail(databasesDeferred.reject)
        );
github cloudera / hue / desktop / core / src / desktop / js / ko / components / ko.pollingCatalogEntriesList.js View on Github external
intialize() {
    const self = this;
    self.pollCount = 0;
    window.clearTimeout(self.pollTimeout);
    self.catalogEntryExists(false);

    if (self.lastPollSourceMetaPromise && self.lastPollSourceMetaPromise.cancel) {
      self.lastPollSourceMetaPromise.cancel();
    }

    dataCatalog
      .getEntry({
        sourceType: ko.unwrap(self.sourceType),
        namespace: ko.unwrap(self.namespace),
        compute: ko.unwrap(self.compute),
        path: ko.unwrap(self.path)
      })
      .done(catalogEntry => {
        self.catalogEntry(catalogEntry);
        self.pollForSourceMeta();
      });
  }
github cloudera / hue / desktop / core / src / desktop / js / ko / components / assist / assistDbNamespace.js View on Github external
self.initDatabases = callback => {
      if (self.loading()) {
        return;
      }
      self.loading(true);
      self.hasErrors(false);

      const lastSelectedDbName = self.selectedDatabase()
        ? self.selectedDatabase().catalogEntry.name
        : null;

      self.selectedDatabase(null);
      self.databases([]);

      dataCatalog
        .getEntry({
          sourceType: self.sourceType,
          namespace: self.namespace,
          compute: self.compute(),
          path: [],
          definition: { type: 'source' }
        })
        .done(catalogEntry => {
          self.catalogEntry = catalogEntry;
          self.catalogEntry
            .getChildren({ silenceErrors: self.navigationSettings.rightAssist })
            .done(databaseEntries => {
              self.dbIndex = {};
              let hasNavMeta = false;
              const dbs = [];