bulltrackers-module 1.0.754 → 1.0.755
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.
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* * FIX: Switched to bigquery.createJob for GCS imports to prevent local file path interpretation errors.
|
|
10
10
|
* * FIX: Improved error logging to catch swallowed BigQuery insert errors.
|
|
11
11
|
* * FIX: finalizeResults now checks for file existence to prevent "Not found" errors on empty results.
|
|
12
|
+
* * FIX: Added SAFE.PARSE_JSON to MERGE statement to handle JSON type mismatch.
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
const { Firestore } = require('@google-cloud/firestore');
|
|
@@ -520,6 +521,10 @@ class StorageManager {
|
|
|
520
521
|
|
|
521
522
|
await this._ensureBigQueryTable(targetTable);
|
|
522
523
|
|
|
524
|
+
// FIX: Added SAFE.PARSE_JSON() to dependency_result_hashes
|
|
525
|
+
// The source (temp table) has this as a STRING (from the JSON file).
|
|
526
|
+
// The destination (target table) has this as JSON.
|
|
527
|
+
// We must explicitly parse the string to JSON during the merge.
|
|
523
528
|
const mergeQuery = `
|
|
524
529
|
MERGE INTO ${fullTarget} T
|
|
525
530
|
USING (
|
|
@@ -533,7 +538,7 @@ class StorageManager {
|
|
|
533
538
|
UPDATE SET
|
|
534
539
|
code_hash = S.code_hash,
|
|
535
540
|
result_hash = S.result_hash,
|
|
536
|
-
dependency_result_hashes = S.dependency_result_hashes,
|
|
541
|
+
dependency_result_hashes = SAFE.PARSE_JSON(S.dependency_result_hashes),
|
|
537
542
|
entity_count = S.entity_count,
|
|
538
543
|
result_data = S.result_data,
|
|
539
544
|
updated_at = S.updated_at
|
|
@@ -541,7 +546,7 @@ class StorageManager {
|
|
|
541
546
|
INSERT (date, computation_name, category, entity_id, code_hash, result_hash,
|
|
542
547
|
dependency_result_hashes, entity_count, result_data, updated_at)
|
|
543
548
|
VALUES (S.date, S.computation_name, S.category, S.entity_id, S.code_hash, S.result_hash,
|
|
544
|
-
S.dependency_result_hashes, S.entity_count, S.result_data, S.updated_at)
|
|
549
|
+
SAFE.PARSE_JSON(S.dependency_result_hashes), S.entity_count, S.result_data, S.updated_at)
|
|
545
550
|
`;
|
|
546
551
|
|
|
547
552
|
await this.bigquery.query({ query: mergeQuery, location: this.config.bigquery.location });
|