sunholo 0.83.1__py3-none-any.whl → 0.83.2__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.
- sunholo/database/alloydb_client.py +35 -5
- {sunholo-0.83.1.dist-info → sunholo-0.83.2.dist-info}/METADATA +2 -2
- {sunholo-0.83.1.dist-info → sunholo-0.83.2.dist-info}/RECORD +7 -7
- {sunholo-0.83.1.dist-info → sunholo-0.83.2.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.83.1.dist-info → sunholo-0.83.2.dist-info}/WHEEL +0 -0
- {sunholo-0.83.1.dist-info → sunholo-0.83.2.dist-info}/entry_points.txt +0 -0
- {sunholo-0.83.1.dist-info → sunholo-0.83.2.dist-info}/top_level.txt +0 -0
|
@@ -43,6 +43,7 @@ class AlloyDBClient:
|
|
|
43
43
|
cluster_name:str=None,
|
|
44
44
|
instance_name:str=None,
|
|
45
45
|
user:str=None,
|
|
46
|
+
password:str=None,
|
|
46
47
|
db="postgres"):
|
|
47
48
|
"""Initializes the AlloyDB client.
|
|
48
49
|
- project_id (str): GCP project ID where the AlloyDB instance resides.
|
|
@@ -71,11 +72,39 @@ class AlloyDBClient:
|
|
|
71
72
|
|
|
72
73
|
self.database = alloydb_config.get("database") or ALLOYDB_DB
|
|
73
74
|
|
|
74
|
-
if user
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
if user:
|
|
76
|
+
log.info("User specified {user} - using pg8000 engine")
|
|
77
|
+
self.user = user
|
|
78
|
+
self.password = password
|
|
79
|
+
self.inst_url = self._build_instance_uri(project_id, region, cluster_name, instance_name)
|
|
80
|
+
self.engine = self._create_engine_from_pg8000()
|
|
81
|
+
else:
|
|
82
|
+
log.info("Build with Langchain engine - will use default service account for auth")
|
|
83
|
+
self.engine = self._create_engine()
|
|
84
|
+
|
|
85
|
+
def _build_instance_uri(self, project_id, region, cluster_name, instance_name):
|
|
86
|
+
return f"projects/{project_id}/locations/{region}/clusters/{cluster_name}/instances/{instance_name}"
|
|
87
|
+
|
|
88
|
+
def _create_engine_from_pg8000(self, user, password, db):
|
|
89
|
+
def getconn() -> pg8000.dbapi.Connection:
|
|
90
|
+
conn = self.connector.connect(
|
|
91
|
+
self.inst_uri,
|
|
92
|
+
"pg8000",
|
|
93
|
+
user=user,
|
|
94
|
+
password=password,
|
|
95
|
+
db=db,
|
|
96
|
+
enable_iam_auth=True,
|
|
97
|
+
)
|
|
98
|
+
return conn
|
|
99
|
+
|
|
100
|
+
engine = sqlalchemy.create_engine(
|
|
101
|
+
"postgresql+pg8000://",
|
|
102
|
+
isolation_level="AUTOCOMMIT",
|
|
103
|
+
creator=getconn)
|
|
104
|
+
engine.dialect.description_encoding = None
|
|
105
|
+
|
|
106
|
+
log.info(f"Created AlloyDB engine for {self.inst_uri} and user: {user}")
|
|
107
|
+
return engine
|
|
79
108
|
|
|
80
109
|
def _create_engine(self):
|
|
81
110
|
if not AlloyDBEngine:
|
|
@@ -91,6 +120,7 @@ class AlloyDBClient:
|
|
|
91
120
|
cluster=self.config["cluster"],
|
|
92
121
|
instance=self.config["instance"],
|
|
93
122
|
user=self.user,
|
|
123
|
+
password=self.password,
|
|
94
124
|
database=self.database,
|
|
95
125
|
ip_type=self.config.get("ip_type") or IPTypes.PRIVATE
|
|
96
126
|
)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.83.
|
|
3
|
+
Version: 0.83.2
|
|
4
4
|
Summary: Large Language Model DevOps - a package to help deploy LLMs to the Cloud.
|
|
5
5
|
Home-page: https://github.com/sunholo-data/sunholo-py
|
|
6
|
-
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.83.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.83.2.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -59,7 +59,7 @@ sunholo/components/retriever.py,sha256=bKIVT7_18Ut3OJd0E0jyiISPnD9qkHWVjcQPT4i1_
|
|
|
59
59
|
sunholo/components/vectorstore.py,sha256=xKk7micTRwZckaI7U6PxvFz_ZSjCH48xPTDYiDcv2tc,5913
|
|
60
60
|
sunholo/database/__init__.py,sha256=bpB5Nk21kwqYj-qdVnvNgXjLsbflnH4g-San7OHMqR4,283
|
|
61
61
|
sunholo/database/alloydb.py,sha256=YH8wNPS8gN-TDZEXQcVHxwd1NScHRfAxma3gK4R6KCk,11740
|
|
62
|
-
sunholo/database/alloydb_client.py,sha256=
|
|
62
|
+
sunholo/database/alloydb_client.py,sha256=xqXhzHoh0e5RKz0wc7MwCayL89JdrYG016Oq-ZSNfBc,12731
|
|
63
63
|
sunholo/database/database.py,sha256=VqhZdkXUNdvWn8sUcUV3YNby1JDVf7IykPVXWBtxo9U,7361
|
|
64
64
|
sunholo/database/lancedb.py,sha256=DyfZntiFKBlVPaFooNN1Z6Pl-LAs4nxWKKuq8GBqN58,715
|
|
65
65
|
sunholo/database/static_dbs.py,sha256=8cvcMwUK6c32AS2e_WguKXWMkFf5iN3g9WHzsh0C07Q,442
|
|
@@ -134,9 +134,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
|
|
|
134
134
|
sunholo/vertex/memory_tools.py,sha256=q_phxgGX2TG2j2MXNULF2xGzQnQPENwjPN9nZ_A9Gh0,7526
|
|
135
135
|
sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
|
|
136
136
|
sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
|
|
137
|
-
sunholo-0.83.
|
|
138
|
-
sunholo-0.83.
|
|
139
|
-
sunholo-0.83.
|
|
140
|
-
sunholo-0.83.
|
|
141
|
-
sunholo-0.83.
|
|
142
|
-
sunholo-0.83.
|
|
137
|
+
sunholo-0.83.2.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
138
|
+
sunholo-0.83.2.dist-info/METADATA,sha256=L_LY3La6qhCknE_-6il21csG0OjyiikTyiPiJTx2EQQ,7413
|
|
139
|
+
sunholo-0.83.2.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
140
|
+
sunholo-0.83.2.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
141
|
+
sunholo-0.83.2.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
142
|
+
sunholo-0.83.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|