From 40d1f731f132ebb29e3eb0abeca860e035c98b6a Mon Sep 17 00:00:00 2001 From: cortadocodes Date: Mon, 13 Dec 2021 11:44:48 +0000 Subject: [PATCH] FIX: Use correct column name when checking configuration uniqueness --- cloud_functions/big_query.py | 13 ++++++++----- setup.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cloud_functions/big_query.py b/cloud_functions/big_query.py index 497c8457..0682e5a7 100644 --- a/cloud_functions/big_query.py +++ b/cloud_functions/big_query.py @@ -200,11 +200,14 @@ def add_configuration(self, configuration): # Installation data is stored in a separate column, so pop it before the next step. installation_data = configuration.pop("installation_data") - configuration_json = json.dumps(configuration) - configuration_hash = blake3(configuration_json.encode()).hexdigest() + software_configuration_json = json.dumps(configuration) + software_configuration_hash = blake3(software_configuration_json.encode()).hexdigest() configurations = list( - self.client.query(f"SELECT id FROM `{table_name}` WHERE `hash`='{configuration_hash}' LIMIT 1").result() + self.client.query( + f"SELECT id FROM `{table_name}` WHERE `software_configuration_hash`='{software_configuration_hash}' " + f"LIMIT 1" + ).result() ) if len(configurations) > 0: @@ -222,8 +225,8 @@ def add_configuration(self, configuration): rows=[ { "id": configuration_id, - "software_configuration": configuration_json, - "software_configuration_hash": configuration_hash, + "software_configuration": software_configuration_json, + "software_configuration_hash": software_configuration_hash, "installation_data": installation_data_json, "installation_data_hash": installation_data_hash, } diff --git a/setup.py b/setup.py index d6e1fd91..28166404 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="data_gateway", - version="0.7.4", + version="0.7.5", install_requires=[ "click>=7.1.2", "pyserial==3.5",