Skip to content

Commit

Permalink
Merge pull request #1178 from Accenture/bugfix/1133-error-when-deploy…
Browse files Browse the repository at this point in the history
…ing-dataextension-sql-statement-nested-too-deeply

Bugfix/1133: fix deploying too many dataExtensions blocked by server error
  • Loading branch information
JoernBerkefeld authored Jan 17, 2024
2 parents 1ae108a + 682a074 commit 5f06796
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions lib/metadataTypes/DataExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,14 @@ class DataExtension extends MetadataType {
*/
static async upsert(metadataMap) {
// get existing DE-fields for DE-keys in deployment package to properly handle add/update/delete of fields
const fieldOptions = {};
for (const key of Object.keys(metadataMap)) {
fieldOptions.filter = fieldOptions.filter
? {
leftOperand: {
leftOperand: 'DataExtension.CustomerKey',
operator: 'equals',
rightOperand: key,
},
operator: 'OR',
rightOperand: fieldOptions.filter,
}
: {
leftOperand: 'DataExtension.CustomerKey',
operator: 'equals',
rightOperand: key,
};
}
// we need to use IN here because it would fail otherwise if we try to deploy too many DEs at the same time
const fieldOptions = {
filter: {
leftOperand: 'DataExtension.CustomerKey',
operator: 'IN',
rightOperand: Object.keys(metadataMap),
},
};
Util.logger.info(` - Caching dependent Metadata: dataExtensionField`);
await this.#attachFields(metadataMap, fieldOptions);

Expand Down Expand Up @@ -868,6 +858,7 @@ class DataExtension extends MetadataType {
static async #attachFields(metadata, fieldOptions, additionalFields) {
const fieldsObj = await this._retrieveFields(fieldOptions, additionalFields);
const fieldKeys = Object.keys(fieldsObj);

// add fields to corresponding DE
for (const key of fieldKeys) {
const field = fieldsObj[key];
Expand Down

0 comments on commit 5f06796

Please sign in to comment.