sunholo 0.127.2__py3-none-any.whl → 0.128.0__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
@@ -136,6 +136,7 @@ def check_write_memories(config:ConfigManager):
136
136
 
137
137
  return write_mem
138
138
 
139
+
139
140
  def discovery_engine_chunker_check(message_data,
140
141
  metadata,
141
142
  vector_name:str=None,
@@ -172,8 +173,6 @@ def discovery_engine_chunker_check(message_data,
172
173
  except Exception as err:
173
174
  log.error(f"Error processing discovery engine: {str(err)} {traceback.format_exc()}")
174
175
  disc_meta = None
175
-
176
- return disc_meta
177
176
 
178
177
  # If discovery engine is the only entry, return
179
178
  if total_discovery_memories == total_memories:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.127.2
3
+ Version: 0.128.0
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
@@ -72,7 +72,7 @@ sunholo/database/sql/sb/delete_source_row.sql,sha256=r6fEuUKdbiLHCDGKSbKINDCpJjs
72
72
  sunholo/database/sql/sb/return_sources.sql,sha256=89KAnxfK8n_qGK9jy1OQT8f9n4uYUtYL5cCxbC2mj_c,255
73
73
  sunholo/database/sql/sb/setup.sql,sha256=CvoFvZQev2uWjmFa3aj3m3iuPFzAAJZ0S7Qi3L3-zZI,89
74
74
  sunholo/discovery_engine/__init__.py,sha256=hLgqRDJ22Aov9o2QjAEfsVgnL3kMdM-g5p8RJ9OyKdQ,130
75
- sunholo/discovery_engine/chunker_handler.py,sha256=44qlTpdtz2GKzrhoQrxVMk-RPVFp7vQDPJoe9KmCcsw,7517
75
+ sunholo/discovery_engine/chunker_handler.py,sha256=wkvXl4rFtYfN6AZUKdW9_QD49Whf77BukDbO82UwlAg,7480
76
76
  sunholo/discovery_engine/cli.py,sha256=KGVle5rkLL49oF9TQhrGI--8017IvvLOEoYur545Qb0,12790
77
77
  sunholo/discovery_engine/create_new.py,sha256=WUi4_xh_dFaGX3xA9jkNKZhaR6LCELjMPeRb0hyj4FU,1226
78
78
  sunholo/discovery_engine/discovery_engine_client.py,sha256=0KhKRFKCvqvtkUOIrCXNk5353t9duuEtUQDhQnN2B24,37335
@@ -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.128.0.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
+ sunholo-0.128.0.dist-info/METADATA,sha256=J6Zt0Y-mKxILQKfONCunRsPBV5bXDHBrnI5lt09dNpQ,10084
173
+ sunholo-0.128.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
174
+ sunholo-0.128.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
+ sunholo-0.128.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
+ sunholo-0.128.0.dist-info/RECORD,,