weave-python 0.27.0__py3-none-any.whl → 0.28.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.
Files changed (33) hide show
  1. weave/weaveapi/llmx/v1/architecture_pb2.py +74 -0
  2. weave/weaveapi/llmx/v1/architecture_pb2.pyi +1323 -0
  3. weave/weaveapi/llmx/v1/capabilities_pb2.py +88 -0
  4. weave/weaveapi/llmx/v1/capabilities_pb2.pyi +1613 -0
  5. weave/weaveapi/llmx/v1/model_pb2.py +54 -0
  6. weave/weaveapi/{modex → llmx}/v1/model_pb2.pyi +294 -189
  7. weave/weaveapi/llmx/v1/model_pb2_grpc.py +2 -0
  8. weave/weaveapi/llmx/v1/model_pb2_grpc.pyi +20 -0
  9. weave/weaveapi/llmx/v1/pricing_pb2.py +54 -0
  10. weave/weaveapi/llmx/v1/pricing_pb2.pyi +597 -0
  11. weave/weaveapi/llmx/v1/pricing_pb2_grpc.py +2 -0
  12. weave/weaveapi/llmx/v1/pricing_pb2_grpc.pyi +20 -0
  13. weave/weaveapi/llmx/v1/provider_pb2.py +38 -0
  14. weave/weaveapi/{modex → llmx}/v1/provider_pb2.pyi +31 -19
  15. weave/weaveapi/llmx/v1/provider_pb2_grpc.py +2 -0
  16. weave/weaveapi/llmx/v1/provider_pb2_grpc.pyi +20 -0
  17. weave/weaveapi/llmx/v1/service_pb2.py +180 -0
  18. weave/weaveapi/{modex → llmx}/v1/service_pb2.pyi +174 -44
  19. weave/weaveapi/{modex → llmx}/v1/service_pb2_grpc.py +103 -105
  20. weave/weaveapi/llmx/v1/service_pb2_grpc.pyi +266 -0
  21. {weave_python-0.27.0.dist-info → weave_python-0.28.0.dist-info}/METADATA +1 -1
  22. {weave_python-0.27.0.dist-info → weave_python-0.28.0.dist-info}/RECORD +27 -17
  23. weave/weaveapi/modex/v1/model_pb2.py +0 -58
  24. weave/weaveapi/modex/v1/provider_pb2.py +0 -38
  25. weave/weaveapi/modex/v1/service_pb2.py +0 -180
  26. weave/weaveapi/modex/v1/service_pb2_grpc.pyi +0 -268
  27. weave/weavesql/weavedb/models.py +0 -124
  28. weave/weavesql/weavedb/queries.py +0 -306
  29. /weave/weaveapi/{modex/v1/model_pb2_grpc.py → llmx/v1/architecture_pb2_grpc.py} +0 -0
  30. /weave/weaveapi/{modex/v1/model_pb2_grpc.pyi → llmx/v1/architecture_pb2_grpc.pyi} +0 -0
  31. /weave/weaveapi/{modex/v1/provider_pb2_grpc.py → llmx/v1/capabilities_pb2_grpc.py} +0 -0
  32. /weave/weaveapi/{modex/v1/provider_pb2_grpc.pyi → llmx/v1/capabilities_pb2_grpc.pyi} +0 -0
  33. {weave_python-0.27.0.dist-info → weave_python-0.28.0.dist-info}/WHEEL +0 -0
@@ -1,268 +0,0 @@
1
- """
2
- @generated by mypy-protobuf. Do not edit manually!
3
- isort:skip_file
4
- """
5
-
6
- import abc
7
- import collections.abc
8
- import grpc
9
- import grpc.aio
10
- import typing
11
- import weaveapi.modex.v1.service_pb2
12
-
13
- _T = typing.TypeVar("_T")
14
-
15
- class _MaybeAsyncIterator(
16
- collections.abc.AsyncIterator[_T],
17
- collections.abc.Iterator[_T],
18
- metaclass=abc.ABCMeta,
19
- ): ...
20
- class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type: ignore[misc, type-arg]
21
- ...
22
-
23
- class ModexStub:
24
- def __init__(
25
- self, channel: typing.Union[grpc.Channel, grpc.aio.Channel]
26
- ) -> None: ...
27
- ListProviders: grpc.UnaryUnaryMultiCallable[
28
- weaveapi.modex.v1.service_pb2.ListProvidersRequest,
29
- weaveapi.modex.v1.service_pb2.ListProvidersResponse,
30
- ]
31
-
32
- GetProvider: grpc.UnaryUnaryMultiCallable[
33
- weaveapi.modex.v1.service_pb2.GetProviderRequest,
34
- weaveapi.modex.v1.service_pb2.GetProviderResponse,
35
- ]
36
-
37
- ListModels: grpc.UnaryUnaryMultiCallable[
38
- weaveapi.modex.v1.service_pb2.ListModelsRequest,
39
- weaveapi.modex.v1.service_pb2.ListModelsResponse,
40
- ]
41
-
42
- GetModel: grpc.UnaryUnaryMultiCallable[
43
- weaveapi.modex.v1.service_pb2.GetModelRequest,
44
- weaveapi.modex.v1.service_pb2.GetModelResponse,
45
- ]
46
-
47
- SearchModels: grpc.UnaryUnaryMultiCallable[
48
- weaveapi.modex.v1.service_pb2.SearchModelsRequest,
49
- weaveapi.modex.v1.service_pb2.SearchModelsResponse,
50
- ]
51
-
52
- CompareModels: grpc.UnaryUnaryMultiCallable[
53
- weaveapi.modex.v1.service_pb2.CompareModelsRequest,
54
- weaveapi.modex.v1.service_pb2.CompareModelsResponse,
55
- ]
56
-
57
- GetModelPriceHistory: grpc.UnaryUnaryMultiCallable[
58
- weaveapi.modex.v1.service_pb2.GetModelPriceHistoryRequest,
59
- weaveapi.modex.v1.service_pb2.GetModelPriceHistoryResponse,
60
- ]
61
-
62
- GetModelChanges: grpc.UnaryUnaryMultiCallable[
63
- weaveapi.modex.v1.service_pb2.GetModelChangesRequest,
64
- weaveapi.modex.v1.service_pb2.GetModelChangesResponse,
65
- ]
66
-
67
- GetTrendingModels: grpc.UnaryUnaryMultiCallable[
68
- weaveapi.modex.v1.service_pb2.GetTrendingModelsRequest,
69
- weaveapi.modex.v1.service_pb2.GetTrendingModelsResponse,
70
- ]
71
-
72
- GetRecentUpdates: grpc.UnaryUnaryMultiCallable[
73
- weaveapi.modex.v1.service_pb2.GetRecentUpdatesRequest,
74
- weaveapi.modex.v1.service_pb2.GetRecentUpdatesResponse,
75
- ]
76
-
77
- ExportData: grpc.UnaryUnaryMultiCallable[
78
- weaveapi.modex.v1.service_pb2.ExportDataRequest,
79
- weaveapi.modex.v1.service_pb2.ExportDataResponse,
80
- ]
81
-
82
- GetStatistics: grpc.UnaryUnaryMultiCallable[
83
- weaveapi.modex.v1.service_pb2.GetStatisticsRequest,
84
- weaveapi.modex.v1.service_pb2.GetStatisticsResponse,
85
- ]
86
-
87
- class ModexAsyncStub:
88
- ListProviders: grpc.aio.UnaryUnaryMultiCallable[
89
- weaveapi.modex.v1.service_pb2.ListProvidersRequest,
90
- weaveapi.modex.v1.service_pb2.ListProvidersResponse,
91
- ]
92
-
93
- GetProvider: grpc.aio.UnaryUnaryMultiCallable[
94
- weaveapi.modex.v1.service_pb2.GetProviderRequest,
95
- weaveapi.modex.v1.service_pb2.GetProviderResponse,
96
- ]
97
-
98
- ListModels: grpc.aio.UnaryUnaryMultiCallable[
99
- weaveapi.modex.v1.service_pb2.ListModelsRequest,
100
- weaveapi.modex.v1.service_pb2.ListModelsResponse,
101
- ]
102
-
103
- GetModel: grpc.aio.UnaryUnaryMultiCallable[
104
- weaveapi.modex.v1.service_pb2.GetModelRequest,
105
- weaveapi.modex.v1.service_pb2.GetModelResponse,
106
- ]
107
-
108
- SearchModels: grpc.aio.UnaryUnaryMultiCallable[
109
- weaveapi.modex.v1.service_pb2.SearchModelsRequest,
110
- weaveapi.modex.v1.service_pb2.SearchModelsResponse,
111
- ]
112
-
113
- CompareModels: grpc.aio.UnaryUnaryMultiCallable[
114
- weaveapi.modex.v1.service_pb2.CompareModelsRequest,
115
- weaveapi.modex.v1.service_pb2.CompareModelsResponse,
116
- ]
117
-
118
- GetModelPriceHistory: grpc.aio.UnaryUnaryMultiCallable[
119
- weaveapi.modex.v1.service_pb2.GetModelPriceHistoryRequest,
120
- weaveapi.modex.v1.service_pb2.GetModelPriceHistoryResponse,
121
- ]
122
-
123
- GetModelChanges: grpc.aio.UnaryUnaryMultiCallable[
124
- weaveapi.modex.v1.service_pb2.GetModelChangesRequest,
125
- weaveapi.modex.v1.service_pb2.GetModelChangesResponse,
126
- ]
127
-
128
- GetTrendingModels: grpc.aio.UnaryUnaryMultiCallable[
129
- weaveapi.modex.v1.service_pb2.GetTrendingModelsRequest,
130
- weaveapi.modex.v1.service_pb2.GetTrendingModelsResponse,
131
- ]
132
-
133
- GetRecentUpdates: grpc.aio.UnaryUnaryMultiCallable[
134
- weaveapi.modex.v1.service_pb2.GetRecentUpdatesRequest,
135
- weaveapi.modex.v1.service_pb2.GetRecentUpdatesResponse,
136
- ]
137
-
138
- ExportData: grpc.aio.UnaryUnaryMultiCallable[
139
- weaveapi.modex.v1.service_pb2.ExportDataRequest,
140
- weaveapi.modex.v1.service_pb2.ExportDataResponse,
141
- ]
142
-
143
- GetStatistics: grpc.aio.UnaryUnaryMultiCallable[
144
- weaveapi.modex.v1.service_pb2.GetStatisticsRequest,
145
- weaveapi.modex.v1.service_pb2.GetStatisticsResponse,
146
- ]
147
-
148
- class ModexServicer(metaclass=abc.ABCMeta):
149
- @abc.abstractmethod
150
- def ListProviders(
151
- self,
152
- request: weaveapi.modex.v1.service_pb2.ListProvidersRequest,
153
- context: _ServicerContext,
154
- ) -> typing.Union[
155
- weaveapi.modex.v1.service_pb2.ListProvidersResponse,
156
- collections.abc.Awaitable[weaveapi.modex.v1.service_pb2.ListProvidersResponse],
157
- ]: ...
158
- @abc.abstractmethod
159
- def GetProvider(
160
- self,
161
- request: weaveapi.modex.v1.service_pb2.GetProviderRequest,
162
- context: _ServicerContext,
163
- ) -> typing.Union[
164
- weaveapi.modex.v1.service_pb2.GetProviderResponse,
165
- collections.abc.Awaitable[weaveapi.modex.v1.service_pb2.GetProviderResponse],
166
- ]: ...
167
- @abc.abstractmethod
168
- def ListModels(
169
- self,
170
- request: weaveapi.modex.v1.service_pb2.ListModelsRequest,
171
- context: _ServicerContext,
172
- ) -> typing.Union[
173
- weaveapi.modex.v1.service_pb2.ListModelsResponse,
174
- collections.abc.Awaitable[weaveapi.modex.v1.service_pb2.ListModelsResponse],
175
- ]: ...
176
- @abc.abstractmethod
177
- def GetModel(
178
- self,
179
- request: weaveapi.modex.v1.service_pb2.GetModelRequest,
180
- context: _ServicerContext,
181
- ) -> typing.Union[
182
- weaveapi.modex.v1.service_pb2.GetModelResponse,
183
- collections.abc.Awaitable[weaveapi.modex.v1.service_pb2.GetModelResponse],
184
- ]: ...
185
- @abc.abstractmethod
186
- def SearchModels(
187
- self,
188
- request: weaveapi.modex.v1.service_pb2.SearchModelsRequest,
189
- context: _ServicerContext,
190
- ) -> typing.Union[
191
- weaveapi.modex.v1.service_pb2.SearchModelsResponse,
192
- collections.abc.Awaitable[weaveapi.modex.v1.service_pb2.SearchModelsResponse],
193
- ]: ...
194
- @abc.abstractmethod
195
- def CompareModels(
196
- self,
197
- request: weaveapi.modex.v1.service_pb2.CompareModelsRequest,
198
- context: _ServicerContext,
199
- ) -> typing.Union[
200
- weaveapi.modex.v1.service_pb2.CompareModelsResponse,
201
- collections.abc.Awaitable[weaveapi.modex.v1.service_pb2.CompareModelsResponse],
202
- ]: ...
203
- @abc.abstractmethod
204
- def GetModelPriceHistory(
205
- self,
206
- request: weaveapi.modex.v1.service_pb2.GetModelPriceHistoryRequest,
207
- context: _ServicerContext,
208
- ) -> typing.Union[
209
- weaveapi.modex.v1.service_pb2.GetModelPriceHistoryResponse,
210
- collections.abc.Awaitable[
211
- weaveapi.modex.v1.service_pb2.GetModelPriceHistoryResponse
212
- ],
213
- ]: ...
214
- @abc.abstractmethod
215
- def GetModelChanges(
216
- self,
217
- request: weaveapi.modex.v1.service_pb2.GetModelChangesRequest,
218
- context: _ServicerContext,
219
- ) -> typing.Union[
220
- weaveapi.modex.v1.service_pb2.GetModelChangesResponse,
221
- collections.abc.Awaitable[
222
- weaveapi.modex.v1.service_pb2.GetModelChangesResponse
223
- ],
224
- ]: ...
225
- @abc.abstractmethod
226
- def GetTrendingModels(
227
- self,
228
- request: weaveapi.modex.v1.service_pb2.GetTrendingModelsRequest,
229
- context: _ServicerContext,
230
- ) -> typing.Union[
231
- weaveapi.modex.v1.service_pb2.GetTrendingModelsResponse,
232
- collections.abc.Awaitable[
233
- weaveapi.modex.v1.service_pb2.GetTrendingModelsResponse
234
- ],
235
- ]: ...
236
- @abc.abstractmethod
237
- def GetRecentUpdates(
238
- self,
239
- request: weaveapi.modex.v1.service_pb2.GetRecentUpdatesRequest,
240
- context: _ServicerContext,
241
- ) -> typing.Union[
242
- weaveapi.modex.v1.service_pb2.GetRecentUpdatesResponse,
243
- collections.abc.Awaitable[
244
- weaveapi.modex.v1.service_pb2.GetRecentUpdatesResponse
245
- ],
246
- ]: ...
247
- @abc.abstractmethod
248
- def ExportData(
249
- self,
250
- request: weaveapi.modex.v1.service_pb2.ExportDataRequest,
251
- context: _ServicerContext,
252
- ) -> typing.Union[
253
- weaveapi.modex.v1.service_pb2.ExportDataResponse,
254
- collections.abc.Awaitable[weaveapi.modex.v1.service_pb2.ExportDataResponse],
255
- ]: ...
256
- @abc.abstractmethod
257
- def GetStatistics(
258
- self,
259
- request: weaveapi.modex.v1.service_pb2.GetStatisticsRequest,
260
- context: _ServicerContext,
261
- ) -> typing.Union[
262
- weaveapi.modex.v1.service_pb2.GetStatisticsResponse,
263
- collections.abc.Awaitable[weaveapi.modex.v1.service_pb2.GetStatisticsResponse],
264
- ]: ...
265
-
266
- def add_ModexServicer_to_server(
267
- servicer: ModexServicer, server: typing.Union[grpc.Server, grpc.aio.Server]
268
- ) -> None: ...
@@ -1,124 +0,0 @@
1
- # Code generated by sqlc. DO NOT EDIT.
2
- # versions:
3
- # sqlc v1.28.0
4
- import dataclasses
5
- import enum
6
- from typing import Any, Optional
7
- import uuid
8
-
9
-
10
- class StorageCategory(enum.StrEnum):
11
- OBJECT_STORE = "object_store"
12
- SQL_DATABASE = "sql_database"
13
- NOSQL_DATABASE = "nosql_database"
14
-
15
-
16
- class StorageVariant(enum.StrEnum):
17
- AWS_S3 = "aws_s3"
18
- AZURE_BLOB_STORAGE = "azure_blob_storage"
19
- GOOGLE_CLOUD_STORAGE = "google_cloud_storage"
20
- MYSQL = "mysql"
21
- POSTGRES = "postgres"
22
- SQL_SERVER = "sql_server"
23
- ORACLE = "oracle"
24
- MARIADB = "mariadb"
25
- SNOWFLAKE = "snowflake"
26
- BIGQUERY = "bigquery"
27
- DATABRICKS = "databricks"
28
- CASSANDRA = "cassandra"
29
- MONGODB = "mongodb"
30
- DYNAMODB = "dynamodb"
31
- COSMOSDB = "cosmosdb"
32
- REDIS = "redis"
33
- VALKEY = "valkey"
34
- ELASTICSEARCH = "elasticsearch"
35
- OPENSEARCH = "opensearch"
36
-
37
-
38
- class SynthesizeV1ColumnDataType(enum.StrEnum):
39
- STRING = "string"
40
- INTEGER = "integer"
41
- FLOAT = "float"
42
- BOOLEAN = "boolean"
43
- TIMESTAMP = "timestamp"
44
- DATE = "date"
45
- BINARY = "binary"
46
- CATEGORICAL = "categorical"
47
- ORDINAL = "ordinal"
48
-
49
-
50
- class SynthesizeV1ColumnRelationshipType(enum.StrEnum):
51
- CONTEXT_FOREIGN_KEY = "context_foreign_key"
52
- NON_CONTEXT_FOREIGN_KEY = "non_context_foreign_key"
53
- ONE_TO_MANY = "one_to_many"
54
- MANY_TO_ONE = "many_to_one"
55
- MANY_TO_MANY = "many_to_many"
56
- SELF_REFERENCE = "self_reference"
57
-
58
-
59
- @dataclasses.dataclass()
60
- class GenerateV1Dataset:
61
- id: uuid.UUID
62
- organization_id: uuid.UUID
63
- name: str
64
- description: Optional[str]
65
- storage_connection_id: uuid.UUID
66
- schema_id: Optional[uuid.UUID]
67
- synthesizer_id: Optional[uuid.UUID]
68
- is_synthetic: Optional[bool]
69
-
70
-
71
- @dataclasses.dataclass()
72
- class Organization:
73
- id: uuid.UUID
74
- name: str
75
- description: Optional[str]
76
-
77
-
78
- @dataclasses.dataclass()
79
- class StorageConnection:
80
- id: uuid.UUID
81
- organization_id: uuid.UUID
82
- name: str
83
- description: Optional[str]
84
- category: StorageCategory
85
- variant: StorageVariant
86
- details: Any
87
-
88
-
89
- @dataclasses.dataclass()
90
- class SynthesizeV1ColumnRelationship:
91
- id: uuid.UUID
92
- source_column_id: uuid.UUID
93
- source_dataset_id: uuid.UUID
94
- target_column_id: uuid.UUID
95
- target_dataset_id: uuid.UUID
96
- relationship_type: Any
97
-
98
-
99
- @dataclasses.dataclass()
100
- class SynthesizeV1DataColumn:
101
- id: uuid.UUID
102
- schema_id: uuid.UUID
103
- name: str
104
- data_type: Any
105
- is_primary_key: Optional[bool]
106
- description: Optional[str]
107
-
108
-
109
- @dataclasses.dataclass()
110
- class SynthesizeV1DataSchema:
111
- id: uuid.UUID
112
- organization_id: uuid.UUID
113
- name: str
114
- description: Optional[str]
115
-
116
-
117
- @dataclasses.dataclass()
118
- class SynthesizeV1Synthesizer:
119
- id: uuid.UUID
120
- organization_id: uuid.UUID
121
- name: str
122
- description: Optional[str]
123
- storage_connection_id: uuid.UUID
124
- metadata: Optional[Any]
@@ -1,306 +0,0 @@
1
- # Code generated by sqlc. DO NOT EDIT.
2
- # versions:
3
- # sqlc v1.28.0
4
- # source: queries.sql
5
- import dataclasses
6
- from typing import Any, AsyncIterator, Iterator, List, Optional
7
- import uuid
8
-
9
- import sqlalchemy
10
- import sqlalchemy.ext.asyncio
11
-
12
- from weave.weavesql.weavedb import models
13
-
14
-
15
- GET_FOREIGN_KEY_RELATIONSHIPS = """-- name: get_foreign_key_relationships \\:many
16
- SELECT cr.source_dataset_id,
17
- cr.target_dataset_id,
18
- sc.name AS source_column_name,
19
- tc.name AS target_column_name
20
- FROM synthesize_v1.column_relationship cr
21
- JOIN
22
- synthesize_v1.data_column sc ON cr.source_column_id = sc.id
23
- JOIN
24
- synthesize_v1.data_column tc ON cr.target_column_id = tc.id
25
- WHERE cr.relationship_type IN ('context_foreign_key', 'non_context_foreign_key')
26
- AND cr.source_dataset_id = ANY (:p1\\:\\:UUID[])
27
- AND cr.target_dataset_id = ANY (:p1\\:\\:UUID[])
28
- """
29
-
30
-
31
- @dataclasses.dataclass()
32
- class GetForeignKeyRelationshipsRow:
33
- source_dataset_id: uuid.UUID
34
- target_dataset_id: uuid.UUID
35
- source_column_name: str
36
- target_column_name: str
37
-
38
-
39
- GET_STORAGE_CONNECTION = """-- name: get_storage_connection \\:one
40
- SELECT id, organization_id, name, description, category, variant, details
41
- FROM storage_connection
42
- WHERE id = :p1
43
- """
44
-
45
-
46
- GET_STORAGE_CONNECTION_BY_DATASET_ID = """-- name: get_storage_connection_by_dataset_id \\:one
47
- SELECT sc.id, sc.organization_id, sc.name, sc.description, sc.category, sc.variant, sc.details
48
- FROM storage_connection sc
49
- JOIN generate_v1.dataset d ON d.storage_connection_id = sc.id
50
- WHERE d.id = :p1
51
- """
52
-
53
-
54
- GET_SYNTHESIZER = """-- name: get_synthesizer \\:one
55
- SELECT id, organization_id, name, description, storage_connection_id, metadata
56
- FROM synthesize_v1.synthesizer
57
- WHERE id = :p1
58
- """
59
-
60
-
61
- UPSERT_DATASET = """-- name: upsert_dataset \\:exec
62
- INSERT INTO generate_v1.dataset (id, organization_id, name, description, storage_connection_id, schema_id,
63
- synthesizer_id, is_synthetic)
64
- VALUES (:p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8)
65
- ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name,
66
- description = EXCLUDED.description,
67
- storage_connection_id = EXCLUDED.storage_connection_id,
68
- schema_id = EXCLUDED.schema_id,
69
- synthesizer_id = EXCLUDED.synthesizer_id,
70
- is_synthetic = EXCLUDED.is_synthetic
71
- """
72
-
73
-
74
- @dataclasses.dataclass()
75
- class UpsertDatasetParams:
76
- id: uuid.UUID
77
- organization_id: uuid.UUID
78
- name: str
79
- description: Optional[str]
80
- storage_connection_id: uuid.UUID
81
- schema_id: Optional[uuid.UUID]
82
- synthesizer_id: Optional[uuid.UUID]
83
- is_synthetic: Optional[bool]
84
-
85
-
86
- UPSERT_SYNTHESIZER = """-- name: upsert_synthesizer \\:exec
87
- INSERT INTO synthesize_v1.synthesizer (id, organization_id, name, description, storage_connection_id, metadata)
88
- VALUES (:p1, :p2, :p3, :p4, :p5, :p6)
89
- ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name,
90
- description = EXCLUDED.description,
91
- storage_connection_id = EXCLUDED.storage_connection_id,
92
- metadata = EXCLUDED.metadata
93
- """
94
-
95
-
96
- @dataclasses.dataclass()
97
- class UpsertSynthesizerParams:
98
- id: uuid.UUID
99
- organization_id: uuid.UUID
100
- name: str
101
- description: Optional[str]
102
- storage_connection_id: uuid.UUID
103
- metadata: Optional[Any]
104
-
105
-
106
- class Querier:
107
- def __init__(self, conn: sqlalchemy.engine.Connection):
108
- self._conn = conn
109
-
110
- def get_foreign_key_relationships(
111
- self, *, dataset_ids: List[uuid.UUID]
112
- ) -> Iterator[GetForeignKeyRelationshipsRow]:
113
- result = self._conn.execute(
114
- sqlalchemy.text(GET_FOREIGN_KEY_RELATIONSHIPS), {"p1": dataset_ids}
115
- )
116
- for row in result:
117
- yield GetForeignKeyRelationshipsRow(
118
- source_dataset_id=row[0],
119
- target_dataset_id=row[1],
120
- source_column_name=row[2],
121
- target_column_name=row[3],
122
- )
123
-
124
- def get_storage_connection(
125
- self, *, id: uuid.UUID
126
- ) -> Optional[models.StorageConnection]:
127
- row = self._conn.execute(
128
- sqlalchemy.text(GET_STORAGE_CONNECTION), {"p1": id}
129
- ).first()
130
- if row is None:
131
- return None
132
- return models.StorageConnection(
133
- id=row[0],
134
- organization_id=row[1],
135
- name=row[2],
136
- description=row[3],
137
- category=row[4],
138
- variant=row[5],
139
- details=row[6],
140
- )
141
-
142
- def get_storage_connection_by_dataset_id(
143
- self, *, dataset_id: uuid.UUID
144
- ) -> Optional[models.StorageConnection]:
145
- row = self._conn.execute(
146
- sqlalchemy.text(GET_STORAGE_CONNECTION_BY_DATASET_ID), {"p1": dataset_id}
147
- ).first()
148
- if row is None:
149
- return None
150
- return models.StorageConnection(
151
- id=row[0],
152
- organization_id=row[1],
153
- name=row[2],
154
- description=row[3],
155
- category=row[4],
156
- variant=row[5],
157
- details=row[6],
158
- )
159
-
160
- def get_synthesizer(
161
- self, *, id: uuid.UUID
162
- ) -> Optional[models.SynthesizeV1Synthesizer]:
163
- row = self._conn.execute(sqlalchemy.text(GET_SYNTHESIZER), {"p1": id}).first()
164
- if row is None:
165
- return None
166
- return models.SynthesizeV1Synthesizer(
167
- id=row[0],
168
- organization_id=row[1],
169
- name=row[2],
170
- description=row[3],
171
- storage_connection_id=row[4],
172
- metadata=row[5],
173
- )
174
-
175
- def upsert_dataset(self, arg: UpsertDatasetParams) -> None:
176
- self._conn.execute(
177
- sqlalchemy.text(UPSERT_DATASET),
178
- {
179
- "p1": arg.id,
180
- "p2": arg.organization_id,
181
- "p3": arg.name,
182
- "p4": arg.description,
183
- "p5": arg.storage_connection_id,
184
- "p6": arg.schema_id,
185
- "p7": arg.synthesizer_id,
186
- "p8": arg.is_synthetic,
187
- },
188
- )
189
-
190
- def upsert_synthesizer(self, arg: UpsertSynthesizerParams) -> None:
191
- self._conn.execute(
192
- sqlalchemy.text(UPSERT_SYNTHESIZER),
193
- {
194
- "p1": arg.id,
195
- "p2": arg.organization_id,
196
- "p3": arg.name,
197
- "p4": arg.description,
198
- "p5": arg.storage_connection_id,
199
- "p6": arg.metadata,
200
- },
201
- )
202
-
203
-
204
- class AsyncQuerier:
205
- def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
206
- self._conn = conn
207
-
208
- async def get_foreign_key_relationships(
209
- self, *, dataset_ids: List[uuid.UUID]
210
- ) -> AsyncIterator[GetForeignKeyRelationshipsRow]:
211
- result = await self._conn.stream(
212
- sqlalchemy.text(GET_FOREIGN_KEY_RELATIONSHIPS), {"p1": dataset_ids}
213
- )
214
- async for row in result:
215
- yield GetForeignKeyRelationshipsRow(
216
- source_dataset_id=row[0],
217
- target_dataset_id=row[1],
218
- source_column_name=row[2],
219
- target_column_name=row[3],
220
- )
221
-
222
- async def get_storage_connection(
223
- self, *, id: uuid.UUID
224
- ) -> Optional[models.StorageConnection]:
225
- row = (
226
- await self._conn.execute(
227
- sqlalchemy.text(GET_STORAGE_CONNECTION), {"p1": id}
228
- )
229
- ).first()
230
- if row is None:
231
- return None
232
- return models.StorageConnection(
233
- id=row[0],
234
- organization_id=row[1],
235
- name=row[2],
236
- description=row[3],
237
- category=row[4],
238
- variant=row[5],
239
- details=row[6],
240
- )
241
-
242
- async def get_storage_connection_by_dataset_id(
243
- self, *, dataset_id: uuid.UUID
244
- ) -> Optional[models.StorageConnection]:
245
- row = (
246
- await self._conn.execute(
247
- sqlalchemy.text(GET_STORAGE_CONNECTION_BY_DATASET_ID),
248
- {"p1": dataset_id},
249
- )
250
- ).first()
251
- if row is None:
252
- return None
253
- return models.StorageConnection(
254
- id=row[0],
255
- organization_id=row[1],
256
- name=row[2],
257
- description=row[3],
258
- category=row[4],
259
- variant=row[5],
260
- details=row[6],
261
- )
262
-
263
- async def get_synthesizer(
264
- self, *, id: uuid.UUID
265
- ) -> Optional[models.SynthesizeV1Synthesizer]:
266
- row = (
267
- await self._conn.execute(sqlalchemy.text(GET_SYNTHESIZER), {"p1": id})
268
- ).first()
269
- if row is None:
270
- return None
271
- return models.SynthesizeV1Synthesizer(
272
- id=row[0],
273
- organization_id=row[1],
274
- name=row[2],
275
- description=row[3],
276
- storage_connection_id=row[4],
277
- metadata=row[5],
278
- )
279
-
280
- async def upsert_dataset(self, arg: UpsertDatasetParams) -> None:
281
- await self._conn.execute(
282
- sqlalchemy.text(UPSERT_DATASET),
283
- {
284
- "p1": arg.id,
285
- "p2": arg.organization_id,
286
- "p3": arg.name,
287
- "p4": arg.description,
288
- "p5": arg.storage_connection_id,
289
- "p6": arg.schema_id,
290
- "p7": arg.synthesizer_id,
291
- "p8": arg.is_synthetic,
292
- },
293
- )
294
-
295
- async def upsert_synthesizer(self, arg: UpsertSynthesizerParams) -> None:
296
- await self._conn.execute(
297
- sqlalchemy.text(UPSERT_SYNTHESIZER),
298
- {
299
- "p1": arg.id,
300
- "p2": arg.organization_id,
301
- "p3": arg.name,
302
- "p4": arg.description,
303
- "p5": arg.storage_connection_id,
304
- "p6": arg.metadata,
305
- },
306
- )