@whaly/connector-sdk 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1274,6 +1274,7 @@ var Stream = class {
|
|
|
1274
1274
|
// Private sync methods:
|
|
1275
1275
|
async _syncRecords(parent) {
|
|
1276
1276
|
let rowsSent = 0;
|
|
1277
|
+
const dryRunLimit = isDryRun() ? getDryRunLimit() : void 0;
|
|
1277
1278
|
let recordSyncedMetrics = [];
|
|
1278
1279
|
if (this.rowsSyncedMetricsConf.isEnabled() === true) {
|
|
1279
1280
|
recordSyncedMetrics = getCounterMetrics(
|
|
@@ -1315,6 +1316,10 @@ var Stream = class {
|
|
|
1315
1316
|
metric.increment();
|
|
1316
1317
|
});
|
|
1317
1318
|
rowsSent += 1;
|
|
1319
|
+
if (dryRunLimit !== void 0 && rowsSent >= dryRunLimit) {
|
|
1320
|
+
logger.info(`\u{1F6D1} Stream: ${this.streamId} - DRY_RUN_LIMIT reached (${dryRunLimit} records), stopping.`);
|
|
1321
|
+
break;
|
|
1322
|
+
}
|
|
1318
1323
|
if (rowsSent % 1e3 === 0) {
|
|
1319
1324
|
const percentStr = this.totalRows ? ` (${Math.round(rowsSent / this.totalRows * 100)}%)` : "";
|
|
1320
1325
|
logger.info(`\u23F3 Stream: ${this.streamId} - ${rowsSent} records synced so far...${percentStr}`);
|
|
@@ -2340,11 +2345,12 @@ var ITarget = class _ITarget {
|
|
|
2340
2345
|
streamState.setSchema(schema);
|
|
2341
2346
|
streamState.setCompiledValidateFn(this.ajv.compile({ type: "object", properties: schema }));
|
|
2342
2347
|
const streamReplicationMethod = this.streams[streamId]?.getReplicationMethod();
|
|
2343
|
-
if (message.keyProperties.length === 0 && streamReplicationMethod
|
|
2348
|
+
if (message.keyProperties.length === 0 && streamReplicationMethod === "INCREMENTAL" /* INCREMENTAL */) {
|
|
2344
2349
|
throw new Error(`StreamId: ${message.stream} - \`key_properties\` field is required and can't be empty in SCHEMA message.
|
|
2345
2350
|
Received SCHEMA message: ${JSON.stringify(message)}`);
|
|
2346
2351
|
}
|
|
2347
2352
|
streamState.setKeyProperties(message.keyProperties);
|
|
2353
|
+
dbSync.renamedColumnStore.computeColumnNameForStream(streamId, schema);
|
|
2348
2354
|
if (!isDryRun()) {
|
|
2349
2355
|
await dbSync.updateSchemaInWarehouse(schema, message.keyProperties);
|
|
2350
2356
|
const {
|
|
@@ -4223,6 +4229,12 @@ var BigQueryDBSync = class extends StreamWarehouseSyncService {
|
|
|
4223
4229
|
});
|
|
4224
4230
|
};
|
|
4225
4231
|
getReplaceQueries = () => {
|
|
4232
|
+
if (this.primaryKeys.length === 0) {
|
|
4233
|
+
return [
|
|
4234
|
+
`TRUNCATE TABLE ${this.sqlTableId};`,
|
|
4235
|
+
...this.getAppendQueries()
|
|
4236
|
+
];
|
|
4237
|
+
}
|
|
4226
4238
|
return [
|
|
4227
4239
|
`TRUNCATE TABLE ${this.sqlTableId};`,
|
|
4228
4240
|
...this.getMergeQueries()
|