UNPKG

n8n-nodes-base

Version:

Base nodes of n8n

37 lines 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.execute = execute; const n8n_workflow_1 = require("n8n-workflow"); const helpers_1 = require("../helpers"); async function execute(i) { const credentialType = (0, helpers_1.getActiveCredentialType)(this, i); const host = await (0, helpers_1.getHost)(this, credentialType); const catalogName = (0, helpers_1.extractResourceLocatorValue)(this.getNodeParameter('catalogName', i)); const schemaName = (0, helpers_1.extractResourceLocatorValue)(this.getNodeParameter('schemaName', i)); const tableName = this.getNodeParameter('tableName', i); const storageLocation = this.getNodeParameter('storageLocation', i); const tableAdditionalFields = this.getNodeParameter('tableAdditionalFields', i, {}); const body = { catalog_name: catalogName, schema_name: schemaName, name: tableName, table_type: 'EXTERNAL', data_source_format: 'DELTA', storage_location: storageLocation, }; if (tableAdditionalFields.columns) { const raw = tableAdditionalFields.columns; body.columns = typeof raw === 'string' ? (0, n8n_workflow_1.jsonParse)(raw) : raw; } if (tableAdditionalFields.comment) body.comment = tableAdditionalFields.comment; const response = await this.helpers.httpRequestWithAuthentication.call(this, credentialType, { method: 'POST', url: `${host}/api/2.1/unity-catalog/tables`, body, headers: { 'Content-Type': 'application/json' }, json: true, }); return [{ json: response, pairedItem: { item: i } }]; } //# sourceMappingURL=createTable.operation.js.map