Compare commits

..
Author SHA1 Message Date
Rafael Santana 209470482a Merge pull request #456 from dadosfera/force-deploy
UPDATE: force deployment of maestro
2026-03-12 18:03:19 -03:00
2 changed files with 16 additions and 18 deletions
@@ -1066,8 +1066,8 @@ export class PlatformApiController {
const rollbackSteps: Array<() => Promise<void>> = []; const rollbackSteps: Array<() => Promise<void>> = [];
try { try {
const dataAsset = await this.elasticsearchService.findDataAssetByTable( const dataAsset = await this.elasticsearchService.findDataAssetByPipelineAndTable(
user.customer_name, oldTableName, oldTableSchema, user.customer_name, pipelineId, oldTableName, oldTableSchema,
); );
if (!dataAsset) { if (!dataAsset) {
@@ -1086,31 +1086,26 @@ export class PlatformApiController {
{ name: oldTableName, table_name: oldTableName, table_schema: oldTableSchema, display_name: oldTableName }, { name: oldTableName, table_name: oldTableName, table_schema: oldTableSchema, display_name: oldTableName },
)); ));
const newTableNameUpper = newValues.table_name.toUpperCase();
const newTableSchemaUpper = newValues.table_schema.toUpperCase();
const oldTableNameUpper = oldTableName.toUpperCase();
const oldTableSchemaUpper = oldTableSchema.toUpperCase();
// Nimbus table-metadata // Nimbus table-metadata
if (nimbusId) { if (nimbusId) {
await this.catalogService.renameTableOnNimbus(nimbusUrl, nimbusId, { table_name: newTableNameUpper, table_schema: newTableSchemaUpper }); await this.catalogService.renameTableOnNimbus(nimbusUrl, nimbusId, newValues);
rollbackSteps.push(() => this.catalogService.renameTableOnNimbus(nimbusUrl, nimbusId, { table_name: oldTableNameUpper, table_schema: oldTableSchemaUpper })); rollbackSteps.push(() => this.catalogService.renameTableOnNimbus(nimbusUrl, nimbusId, oldValues));
} }
// Nimbus column-metadata // Nimbus column-metadata
await this.catalogService.renameColumnMetadataOnNimbus( await this.catalogService.renameColumnMetadataOnNimbus(
nimbusUrl, databaseName, oldTableNameUpper, oldTableSchemaUpper, newTableNameUpper, newTableSchemaUpper, nimbusUrl, databaseName, oldTableName, oldTableSchema, newValues.table_name, newValues.table_schema,
); );
rollbackSteps.push(() => this.catalogService.renameColumnMetadataOnNimbus( rollbackSteps.push(() => this.catalogService.renameColumnMetadataOnNimbus(
nimbusUrl, databaseName, newTableNameUpper, newTableSchemaUpper, oldTableNameUpper, oldTableSchemaUpper, nimbusUrl, databaseName, newValues.table_name, newValues.table_schema, oldTableName, oldTableSchema,
)); ));
// Nimbus data-preview // Nimbus data-preview
await this.catalogService.renameDataPreviewOnNimbus( await this.catalogService.renameDataPreviewOnNimbus(
nimbusUrl, databaseName, oldTableNameUpper, oldTableSchemaUpper, newTableNameUpper, newTableSchemaUpper, nimbusUrl, databaseName, oldTableName, oldTableSchema, newValues.table_name, newValues.table_schema,
); );
rollbackSteps.push(() => this.catalogService.renameDataPreviewOnNimbus( rollbackSteps.push(() => this.catalogService.renameDataPreviewOnNimbus(
nimbusUrl, databaseName, newTableNameUpper, newTableSchemaUpper, oldTableNameUpper, oldTableSchemaUpper, nimbusUrl, databaseName, newValues.table_name, newValues.table_schema, oldTableName, oldTableSchema,
)); ));
this.logger.info(`Synced catalog rename for ${key}`, { jobId, oldTableName, newTableName: newValues.table_name }); this.logger.info(`Synced catalog rename for ${key}`, { jobId, oldTableName, newTableName: newValues.table_name });
@@ -362,8 +362,9 @@ export class ElasticsearchService {
return `${customerName}_data_assets_catalog`; return `${customerName}_data_assets_catalog`;
} }
async findDataAssetByTable( async findDataAssetByPipelineAndTable(
customerName: string, customerName: string,
pipelineId: string,
tableName: string, tableName: string,
tableSchema: string, tableSchema: string,
): Promise<{ id: string; nimbus_id: number | null; [key: string]: any } | null> { ): Promise<{ id: string; nimbus_id: number | null; [key: string]: any } | null> {
@@ -371,6 +372,7 @@ export class ElasticsearchService {
this.logger.info('Elasticsearch: Searching data asset', { this.logger.info('Elasticsearch: Searching data asset', {
index, index,
pipelineId,
tableName, tableName,
tableSchema, tableSchema,
}); });
@@ -380,8 +382,9 @@ export class ElasticsearchService {
query: { query: {
bool: { bool: {
must: [ must: [
{ term: { 'table_name.keyword': tableName.toUpperCase() } }, { term: { 'pipeline_id.keyword': pipelineId } },
{ term: { 'table_schema.keyword': tableSchema.toUpperCase() } }, { term: { 'table_name.keyword': tableName } },
{ term: { 'table_schema.keyword': tableSchema } },
], ],
}, },
}, },
@@ -390,13 +393,13 @@ export class ElasticsearchService {
const hits = response.data.hits?.hits || []; const hits = response.data.hits?.hits || [];
if (hits.length === 0) { if (hits.length === 0) {
this.logger.warn('Elasticsearch: Data asset not found', { tableName, tableSchema, index }); this.logger.warn('Elasticsearch: Data asset not found', { pipelineId, tableName, tableSchema, index });
return null; return null;
} }
return { ...hits[0]._source, _es_id: hits[0]._id }; return { ...hits[0]._source, _es_id: hits[0]._id };
} catch (error) { } catch (error) {
this.handleError('findDataAssetByTable', error, { tableName, tableSchema, index }); this.handleError('findDataAssetByPipelineAndTable', error, { pipelineId, tableName, tableSchema, index });
throw error; throw error;
} }
} }