sunholo 0.127.2__py3-none-any.whl → 0.127.3__py3-none-any.whl

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.
@@ -883,6 +883,64 @@ class AlloyDBClient:
883
883
  log.info(f"Inserted data into table {table_name}")
884
884
 
885
885
  return result
886
+
887
+ async def update_row(self, table_name: str, primary_key_column: str, primary_key_value: str,
888
+ update_data: dict, condition: str = None):
889
+ """
890
+ Updates a row in the specified table based on the primary key.
891
+
892
+ Args:
893
+ table_name (str): Name of the table to update
894
+ primary_key_column (str): Name of the primary key column (e.g., 'acdid')
895
+ primary_key_value (str): Value of the primary key for the row to update
896
+ update_data (dict): Dictionary containing column names and values to update
897
+ condition (str, optional): Additional condition for the WHERE clause
898
+
899
+ Returns:
900
+ Result of SQL execution
901
+ """
902
+ if not update_data:
903
+ raise ValueError("No update data provided")
904
+
905
+ # Generate SET clause parts
906
+ set_parts = []
907
+ processed_values = {}
908
+
909
+ for i, (key, value) in enumerate(update_data.items()):
910
+ # Create a unique parameter name
911
+ param_name = f"param_{i}"
912
+ # For JSON values, convert to string
913
+ if isinstance(value, (dict, list)):
914
+ processed_values[param_name] = json.dumps(value)
915
+ else:
916
+ processed_values[param_name] = value
917
+
918
+ set_parts.append(f'"{key}" = :{param_name}')
919
+
920
+ # Create the WHERE clause
921
+ where_clause = f'"{primary_key_column}" = :pk_value'
922
+ processed_values['pk_value'] = primary_key_value
923
+
924
+ if condition:
925
+ where_clause += f" AND ({condition})"
926
+
927
+ # Construct the SQL statement
928
+ set_clause = ", ".join(set_parts)
929
+ sql = f'UPDATE "{table_name}" SET {set_clause} WHERE {where_clause} RETURNING {primary_key_column}'
930
+
931
+ log.info(f"Executing update on {table_name} for {primary_key_column}={primary_key_value}")
932
+
933
+ # Execute SQL based on engine type
934
+ if self.engine_type == "pg8000":
935
+ # Use the synchronous method for pg8000
936
+ result = self._execute_sql_pg8000(sql, processed_values)
937
+ else:
938
+ # Use the async method for langchain
939
+ result = await self._execute_sql_async_langchain(sql, processed_values)
940
+
941
+ log.info(f"Updated row in {table_name} with {primary_key_column}={primary_key_value}")
942
+
943
+ return result
886
944
 
887
945
  async def get_table_columns(self, table_name, schema="public"):
888
946
  """
@@ -1150,7 +1208,7 @@ class AlloyDBClient:
1150
1208
  results['errors'].append(error_info)
1151
1209
  results['failed_rows'] += 1
1152
1210
 
1153
- log.error(f"Error inserting row {i}: {e}")
1211
+ log.error(f"Error inserting row {i}: {e} for data: {row}")
1154
1212
 
1155
1213
  if not continue_on_error:
1156
1214
  results['success'] = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.127.2
3
+ Version: 0.127.3
4
4
  Summary: Large Language Model DevOps - a package to help deploy LLMs to the Cloud.
5
5
  Author-email: Holosun ApS <multivac@sunholo.com>
6
6
  License: Apache License, Version 2.0
@@ -60,7 +60,7 @@ sunholo/components/retriever.py,sha256=Wmchv3huAM4w7DIS-a5Lp9Hi7M8pE6vZdxgseiT9S
60
60
  sunholo/components/vectorstore.py,sha256=k7GS1Y5c6ZGXSDAJvyCes6dTjhDAi0fjGbVLqpyfzBc,5918
61
61
  sunholo/database/__init__.py,sha256=bpB5Nk21kwqYj-qdVnvNgXjLsbflnH4g-San7OHMqR4,283
62
62
  sunholo/database/alloydb.py,sha256=x1zUMB-EVWbE2Zvp4nAs2Z-tB_kOZmS45H2lwVHdYnk,11678
63
- sunholo/database/alloydb_client.py,sha256=bVP91jz6gizJrzgAize5EIx64htHybDVN9UGZpGSXi4,50703
63
+ sunholo/database/alloydb_client.py,sha256=pZ6n6Is1NOw1lMqDlKm7XyyFxoAirkbPt6in4XPjBjE,53148
64
64
  sunholo/database/database.py,sha256=VqhZdkXUNdvWn8sUcUV3YNby1JDVf7IykPVXWBtxo9U,7361
65
65
  sunholo/database/lancedb.py,sha256=DyfZntiFKBlVPaFooNN1Z6Pl-LAs4nxWKKuq8GBqN58,715
66
66
  sunholo/database/static_dbs.py,sha256=8cvcMwUK6c32AS2e_WguKXWMkFf5iN3g9WHzsh0C07Q,442
@@ -168,9 +168,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
168
168
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
169
169
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
170
170
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
171
- sunholo-0.127.2.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
- sunholo-0.127.2.dist-info/METADATA,sha256=vflFwcPWETDwMH45GRhr5McMoghZpm8-hspdiP3qNZs,10084
173
- sunholo-0.127.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
174
- sunholo-0.127.2.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
- sunholo-0.127.2.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
- sunholo-0.127.2.dist-info/RECORD,,
171
+ sunholo-0.127.3.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
+ sunholo-0.127.3.dist-info/METADATA,sha256=Cw-b89amd_DtSRdUVOV-kPMUnVKfMzHj1m9oAnvzam4,10084
173
+ sunholo-0.127.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
174
+ sunholo-0.127.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
+ sunholo-0.127.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
+ sunholo-0.127.3.dist-info/RECORD,,