How to use the catalog/dataCatalogEntry 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 / catalog / dataCatalog.js View on Github external
entry.analysisPromise = $.Deferred()
        .resolve(entry.analysis)
        .promise();
    };

    let removeTable = function() {}; // noop until actually added

    const sourceIdentifier = generateEntryCacheId({
      namespace: options.namespace,
      path: []
    });

    if (!self.temporaryEntries[sourceIdentifier]) {
      const sourceDeferred = $.Deferred();
      self.temporaryEntries[sourceIdentifier] = sourceDeferred.promise();
      const sourceEntry = new DataCatalogEntry({
        isTemporary: true,
        dataCatalog: self,
        namespace: options.namespace,
        compute: options.compute,
        path: [],
        definition: {
          index: 0,
          navOptLoaded: true,
          type: 'source'
        }
      });
      addEntryMeta(sourceEntry);
      identifiersToClean.push(sourceIdentifier);
      sourceEntry.childrenPromise = $.Deferred()
        .resolve([])
        .promise();
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalog.js View on Github external
.catch(error => {
          console.warn(error);
          const entry = new DataCatalogEntry({
            dataCatalog: self,
            namespace: options.namespace,
            compute: options.compute,
            path: options.path,
            definition: options.definition
          });
          if (!options.cachedOnly && options.definition) {
            entry.saveLater();
          }
          deferred.resolve(entry);
        });
    }
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalog.js View on Github external
.then(storeEntry => {
          const definition = storeEntry ? storeEntry.definition : options.definition;
          const entry = new DataCatalogEntry({
            dataCatalog: self,
            namespace: options.namespace,
            compute: options.compute,
            path: options.path,
            definition: definition
          });
          if (storeEntry) {
            mergeEntry(entry, storeEntry);
          } else if (!options.cachedOnly && options.definition) {
            entry.saveLater();
          }
          deferred.resolve(entry);
        })
        .catch(error => {
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalog.js View on Github external
options.columns.forEach(column => {
                const columnPath = path.concat(column.name);
                const columnIdentifier = generateEntryCacheId({
                  namespace: options.namespace,
                  path: columnPath
                });

                const columnDeferred = $.Deferred();
                self.temporaryEntries[columnIdentifier] = columnDeferred.promise();
                identifiersToClean.push(columnIdentifier);

                const columnEntry = new DataCatalogEntry({
                  isTemporary: true,
                  dataCatalog: self,
                  namespace: options.namespace,
                  compute: options.compute,
                  path: columnPath,
                  definition: {
                    comment: '',
                    index: index++,
                    name: column.name,
                    partitionKey: false,
                    type: column.type
                  }
                });

                columnEntry.sample = {
                  data: [],
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalog.js View on Github external
$.Deferred()
          .reject()
          .promise()
      );
    }
    if (self.entries[identifier]) {
      return self.entries[identifier];
    }

    const deferred = $.Deferred();
    self.entries[identifier] = deferred.promise();

    if (!cacheEnabled) {
      deferred
        .resolve(
          new DataCatalogEntry({
            dataCatalog: self,
            namespace: options.namespace,
            compute: options.compute,
            path: options.path,
            definition: options.definition
          })
        )
        .promise();
    } else {
      self.store
        .getItem(identifier)
        .then(storeEntry => {
          const definition = storeEntry ? storeEntry.definition : options.definition;
          const entry = new DataCatalogEntry({
            dataCatalog: self,
            namespace: options.namespace,
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalog.js View on Github external
databaseEntry.getChildren().done(existingTemporaryTables => {
            const tableIdentifier = generateEntryCacheId({
              namespace: options.namespace,
              path: path
            });
            self.temporaryEntries[tableIdentifier] = tableDeferred.promise();
            identifiersToClean.push(tableIdentifier);

            const tableEntry = new DataCatalogEntry({
              isTemporary: true,
              dataCatalog: self,
              namespace: options.namespace,
              compute: options.compute,
              path: path,
              definition: {
                comment: '',
                index: 0,
                name: options.name,
                navOptLoaded: true,
                type: 'table'
              }
            });
            existingTemporaryTables.push(tableEntry);
            const indexToDelete = existingTemporaryTables.length - 1;
            removeTable = function() {
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalog.js View on Github external
sourceEntry.getChildren().done(existingTemporaryDatabases => {
        const databaseIdentifier = generateEntryCacheId({
          namespace: options.namespace,
          path: ['default']
        });

        if (!self.temporaryEntries[databaseIdentifier]) {
          const databaseDeferred = $.Deferred();
          self.temporaryEntries[databaseIdentifier] = databaseDeferred.promise();
          const databaseEntry = new DataCatalogEntry({
            isTemporary: true,
            dataCatalog: self,
            namespace: options.namespace,
            compute: options.compute,
            path: ['default'],
            definition: {
              index: 0,
              navOptLoaded: true,
              type: 'database'
            }
          });
          addEntryMeta(databaseEntry);
          identifiersToClean.push(databaseIdentifier);
          databaseEntry.childrenPromise = $.Deferred()
            .resolve([])
            .promise();