bulltrackers-module 1.0.756 → 1.0.757

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.
@@ -523,9 +523,6 @@ class StorageManager {
523
523
 
524
524
  await this._ensureBigQueryTable(targetTable);
525
525
 
526
- // FIX: Added SAFE.PARSE_JSON() to BOTH dependency_result_hashes AND result_data
527
- // The source (temp table) has these as STRING (from the JSON file).
528
- // The destination (target table) has these as JSON types.
529
526
  const mergeQuery = `
530
527
  MERGE INTO ${fullTarget} T
531
528
  USING (
@@ -550,7 +547,24 @@ class StorageManager {
550
547
  SAFE.PARSE_JSON(S.dependency_result_hashes), S.entity_count, SAFE.PARSE_JSON(S.result_data), S.updated_at)
551
548
  `;
552
549
 
553
- await this.bigquery.query({ query: mergeQuery, location: this.config.bigquery.location });
550
+ // UPDATE: Use createQueryJob to capture DML statistics
551
+ try {
552
+ const [job] = await this.bigquery.createQueryJob({
553
+ query: mergeQuery,
554
+ location: this.config.bigquery.location
555
+ });
556
+
557
+ await job.getQueryResults(); // Wait for completion
558
+
559
+ const metadata = await job.getMetadata();
560
+ const stats = metadata[0]?.statistics?.query;
561
+ const affectedRows = stats?.numDmlAffectedRows;
562
+
563
+ this._log('INFO', `Merge complete on ${targetTable}. Rows affected (Inserted/Updated): ${affectedRows}`);
564
+ } catch (e) {
565
+ this._logError(`Merge Failed on ${targetTable}`, e);
566
+ throw e;
567
+ }
554
568
  }
555
569
 
556
570
  async _cleanupGCSFiles(bucketName, prefix) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.756",
3
+ "version": "1.0.757",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [