skyflow-flowvault-python 1.0.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.
- common/.coveragerc +4 -0
- common/__init__.py +3 -0
- common/client/__init__.py +0 -0
- common/client/base_skyflow.py +345 -0
- common/client/utils/__init__.py +1 -0
- common/client/utils/_utils.py +127 -0
- common/errors/__init__.py +1 -0
- common/errors/_skyflow_error.py +17 -0
- common/generated/__init__.py +0 -0
- common/generated/rest/__init__.py +24 -0
- common/generated/rest/authentication/__init__.py +4 -0
- common/generated/rest/authentication/client.py +181 -0
- common/generated/rest/authentication/raw_client.py +241 -0
- common/generated/rest/client.py +153 -0
- common/generated/rest/core/__init__.py +52 -0
- common/generated/rest/core/api_error.py +23 -0
- common/generated/rest/core/client_wrapper.py +86 -0
- common/generated/rest/core/datetime_utils.py +28 -0
- common/generated/rest/core/file.py +67 -0
- common/generated/rest/core/force_multipart.py +16 -0
- common/generated/rest/core/http_client.py +543 -0
- common/generated/rest/core/http_response.py +55 -0
- common/generated/rest/core/jsonable_encoder.py +100 -0
- common/generated/rest/core/pydantic_utilities.py +255 -0
- common/generated/rest/core/query_encoder.py +58 -0
- common/generated/rest/core/remove_none_from_dict.py +11 -0
- common/generated/rest/core/request_options.py +35 -0
- common/generated/rest/core/serialization.py +276 -0
- common/generated/rest/environment.py +8 -0
- common/generated/rest/errors/__init__.py +9 -0
- common/generated/rest/errors/bad_request_error.py +14 -0
- common/generated/rest/errors/not_found_error.py +14 -0
- common/generated/rest/errors/unauthorized_error.py +14 -0
- common/generated/rest/py.typed +0 -0
- common/generated/rest/types/__init__.py +9 -0
- common/generated/rest/types/googlerpc_status.py +22 -0
- common/generated/rest/types/protobuf_any.py +21 -0
- common/generated/rest/types/v_1_get_auth_token_response.py +33 -0
- common/generated/rest/version.py +6 -0
- common/service_account/__init__.py +1 -0
- common/service_account/_utils.py +248 -0
- common/service_account/client/__init__.py +0 -0
- common/service_account/client/auth_client.py +13 -0
- common/utils/__init__.py +4 -0
- common/utils/_helpers.py +18 -0
- common/utils/_skyflow_messages.py +445 -0
- common/utils/_utils.py +50 -0
- common/utils/constants.py +291 -0
- common/utils/enums/__init__.py +12 -0
- common/utils/enums/content_types.py +9 -0
- common/utils/enums/detect_entities.py +73 -0
- common/utils/enums/detect_output_transcriptions.py +8 -0
- common/utils/enums/env.py +13 -0
- common/utils/enums/log_level.py +8 -0
- common/utils/enums/masking_method.py +5 -0
- common/utils/enums/redaction_type.py +7 -0
- common/utils/enums/request_method.py +8 -0
- common/utils/enums/token_mode.py +6 -0
- common/utils/enums/token_type.py +6 -0
- common/utils/logger/__init__.py +2 -0
- common/utils/logger/_log_helpers.py +47 -0
- common/utils/logger/_logger.py +50 -0
- common/utils/validations/__init__.py +11 -0
- common/utils/validations/_validations.py +267 -0
- common/vault/base_vault_client.py +122 -0
- common/vault/base_vault_controller.py +58 -0
- common/vault/data/__init__.py +2 -0
- common/vault/data/_base_insert_request.py +7 -0
- common/vault/data/_base_insert_response.py +11 -0
- skyflow/__init__.py +2 -0
- skyflow/client/__init__.py +1 -0
- skyflow/client/_http_config_builder.py +45 -0
- skyflow/client/skyflow.py +15 -0
- skyflow/error/__init__.py +3 -0
- skyflow/generated/__init__.py +0 -0
- skyflow/generated/rest/__init__.py +164 -0
- skyflow/generated/rest/_default_clients.py +32 -0
- skyflow/generated/rest/client.py +385 -0
- skyflow/generated/rest/core/__init__.py +127 -0
- skyflow/generated/rest/core/api_error.py +23 -0
- skyflow/generated/rest/core/client_wrapper.py +148 -0
- skyflow/generated/rest/core/datetime_utils.py +70 -0
- skyflow/generated/rest/core/file.py +67 -0
- skyflow/generated/rest/core/force_multipart.py +18 -0
- skyflow/generated/rest/core/http_client.py +940 -0
- skyflow/generated/rest/core/http_response.py +63 -0
- skyflow/generated/rest/core/http_sse/__init__.py +42 -0
- skyflow/generated/rest/core/http_sse/_api.py +455 -0
- skyflow/generated/rest/core/http_sse/_decoders.py +74 -0
- skyflow/generated/rest/core/http_sse/_exceptions.py +7 -0
- skyflow/generated/rest/core/http_sse/_models.py +17 -0
- skyflow/generated/rest/core/jsonable_encoder.py +133 -0
- skyflow/generated/rest/core/logging.py +107 -0
- skyflow/generated/rest/core/parse_error.py +36 -0
- skyflow/generated/rest/core/pydantic_utilities.py +486 -0
- skyflow/generated/rest/core/query_encoder.py +58 -0
- skyflow/generated/rest/core/remove_none_from_dict.py +11 -0
- skyflow/generated/rest/core/request_options.py +40 -0
- skyflow/generated/rest/core/serialization.py +347 -0
- skyflow/generated/rest/environment.py +8 -0
- skyflow/generated/rest/errors/__init__.py +53 -0
- skyflow/generated/rest/errors/bad_request_error.py +11 -0
- skyflow/generated/rest/errors/forbidden_error.py +11 -0
- skyflow/generated/rest/errors/internal_server_error.py +11 -0
- skyflow/generated/rest/errors/not_found_error.py +11 -0
- skyflow/generated/rest/errors/too_many_requests_error.py +11 -0
- skyflow/generated/rest/errors/unauthorized_error.py +11 -0
- skyflow/generated/rest/py.typed +0 -0
- skyflow/generated/rest/query/__init__.py +4 -0
- skyflow/generated/rest/query/client.py +139 -0
- skyflow/generated/rest/query/raw_client.py +239 -0
- skyflow/generated/rest/raw_client.py +86 -0
- skyflow/generated/rest/records/__init__.py +34 -0
- skyflow/generated/rest/records/client.py +685 -0
- skyflow/generated/rest/records/raw_client.py +988 -0
- skyflow/generated/rest/records/types/__init__.py +34 -0
- skyflow/generated/rest/records/types/update_request_update_type.py +5 -0
- skyflow/generated/rest/tokens/__init__.py +4 -0
- skyflow/generated/rest/tokens/client.py +246 -0
- skyflow/generated/rest/tokens/raw_client.py +507 -0
- skyflow/generated/rest/types/__init__.py +116 -0
- skyflow/generated/rest/types/column_redactions.py +33 -0
- skyflow/generated/rest/types/delete_response.py +23 -0
- skyflow/generated/rest/types/delete_response_object.py +42 -0
- skyflow/generated/rest/types/detokenize_response.py +23 -0
- skyflow/generated/rest/types/detokenize_response_object.py +54 -0
- skyflow/generated/rest/types/error_response.py +20 -0
- skyflow/generated/rest/types/error_response_error.py +28 -0
- skyflow/generated/rest/types/execute_query_record_response.py +22 -0
- skyflow/generated/rest/types/execute_query_response.py +26 -0
- skyflow/generated/rest/types/execute_query_response_metadata.py +26 -0
- skyflow/generated/rest/types/get_request_data.py +60 -0
- skyflow/generated/rest/types/get_response.py +23 -0
- skyflow/generated/rest/types/get_tokens_from_values_request_object.py +30 -0
- skyflow/generated/rest/types/get_tokens_from_values_response.py +23 -0
- skyflow/generated/rest/types/google_protobuf_value.py +8 -0
- skyflow/generated/rest/types/http_code.py +6 -0
- skyflow/generated/rest/types/insert_record_data.py +36 -0
- skyflow/generated/rest/types/insert_response.py +23 -0
- skyflow/generated/rest/types/record_response_object.py +70 -0
- skyflow/generated/rest/types/token_group_redactions.py +33 -0
- skyflow/generated/rest/types/tokenize_response_object.py +49 -0
- skyflow/generated/rest/types/unique_value.py +22 -0
- skyflow/generated/rest/types/update_record_data.py +52 -0
- skyflow/generated/rest/types/update_record_data_update_type.py +5 -0
- skyflow/generated/rest/types/update_response.py +23 -0
- skyflow/generated/rest/types/upsert.py +45 -0
- skyflow/generated/rest/types/upsert_update_type.py +5 -0
- skyflow/generated/rest/version.py +6 -0
- skyflow/service_account/__init__.py +15 -0
- skyflow/utils/__init__.py +9 -0
- skyflow/utils/_http_config.py +36 -0
- skyflow/utils/_response_parsing.py +66 -0
- skyflow/utils/_retry.py +97 -0
- skyflow/utils/_skyflow_messages.py +114 -0
- skyflow/utils/_utils.py +54 -0
- skyflow/utils/_version.py +1 -0
- skyflow/utils/enums/__init__.py +3 -0
- skyflow/utils/enums/_custom_header_key.py +10 -0
- skyflow/utils/enums/_env_urls.py +9 -0
- skyflow/utils/enums/_upsert_type.py +7 -0
- skyflow/utils/validations/__init__.py +9 -0
- skyflow/utils/validations/_validations.py +195 -0
- skyflow/vault/__init__.py +0 -0
- skyflow/vault/client/__init__.py +0 -0
- skyflow/vault/client/client.py +102 -0
- skyflow/vault/controller/__init__.py +1 -0
- skyflow/vault/controller/_vault.py +475 -0
- skyflow/vault/data/__init__.py +30 -0
- skyflow/vault/data/_column_redactions.py +4 -0
- skyflow/vault/data/_delete_options.py +8 -0
- skyflow/vault/data/_delete_request.py +5 -0
- skyflow/vault/data/_delete_response.py +9 -0
- skyflow/vault/data/_delete_response_record.py +9 -0
- skyflow/vault/data/_detokenize_options.py +8 -0
- skyflow/vault/data/_detokenize_request.py +9 -0
- skyflow/vault/data/_detokenize_response.py +9 -0
- skyflow/vault/data/_detokenize_response_record.py +16 -0
- skyflow/vault/data/_detokenize_response_record_metadata.py +10 -0
- skyflow/vault/data/_get_options.py +8 -0
- skyflow/vault/data/_get_request.py +17 -0
- skyflow/vault/data/_get_request_record.py +13 -0
- skyflow/vault/data/_get_response.py +9 -0
- skyflow/vault/data/_get_response_record.py +17 -0
- skyflow/vault/data/_insert_options.py +8 -0
- skyflow/vault/data/_insert_request.py +11 -0
- skyflow/vault/data/_insert_request_record.py +9 -0
- skyflow/vault/data/_insert_response.py +9 -0
- skyflow/vault/data/_insert_response_record.py +17 -0
- skyflow/vault/data/_request_context.py +16 -0
- skyflow/vault/data/_token.py +8 -0
- skyflow/vault/data/_token_group_redactions.py +4 -0
- skyflow/vault/data/_update_options.py +8 -0
- skyflow/vault/data/_update_request.py +11 -0
- skyflow/vault/data/_update_request_record.py +6 -0
- skyflow/vault/data/_update_response.py +9 -0
- skyflow/vault/data/_update_response_record.py +17 -0
- skyflow/vault/data/_upsert_options.py +7 -0
- skyflow_flowvault_python-1.0.0.dist-info/METADATA +896 -0
- skyflow_flowvault_python-1.0.0.dist-info/RECORD +202 -0
- skyflow_flowvault_python-1.0.0.dist-info/WHEEL +5 -0
- skyflow_flowvault_python-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,685 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.column_redactions import ColumnRedactions
|
|
8
|
+
from ..types.delete_response import DeleteResponse
|
|
9
|
+
from ..types.get_request_data import GetRequestData
|
|
10
|
+
from ..types.get_response import GetResponse
|
|
11
|
+
from ..types.insert_record_data import InsertRecordData
|
|
12
|
+
from ..types.insert_response import InsertResponse
|
|
13
|
+
from ..types.unique_value import UniqueValue
|
|
14
|
+
from ..types.update_record_data import UpdateRecordData
|
|
15
|
+
from ..types.update_response import UpdateResponse
|
|
16
|
+
from ..types.upsert import Upsert
|
|
17
|
+
from .raw_client import AsyncRawRecordsClient, RawRecordsClient
|
|
18
|
+
from .types.update_request_update_type import UpdateRequestUpdateType
|
|
19
|
+
|
|
20
|
+
# this is used as the default value for optional parameters
|
|
21
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class RecordsClient:
|
|
25
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
|
+
self._raw_client = RawRecordsClient(client_wrapper=client_wrapper)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def with_raw_response(self) -> RawRecordsClient:
|
|
30
|
+
"""
|
|
31
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
-------
|
|
35
|
+
RawRecordsClient
|
|
36
|
+
"""
|
|
37
|
+
return self._raw_client
|
|
38
|
+
|
|
39
|
+
def delete_records(
|
|
40
|
+
self,
|
|
41
|
+
*,
|
|
42
|
+
vault_id: str,
|
|
43
|
+
table_name: typing.Optional[str] = OMIT,
|
|
44
|
+
skyflow_i_ds: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
45
|
+
unique_values: typing.Optional[typing.Sequence[UniqueValue]] = OMIT,
|
|
46
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
47
|
+
) -> DeleteResponse:
|
|
48
|
+
"""
|
|
49
|
+
Deletes records from a vault.
|
|
50
|
+
|
|
51
|
+
Parameters
|
|
52
|
+
----------
|
|
53
|
+
vault_id : str
|
|
54
|
+
ID of the vault.
|
|
55
|
+
|
|
56
|
+
table_name : typing.Optional[str]
|
|
57
|
+
Name of the table.
|
|
58
|
+
|
|
59
|
+
skyflow_i_ds : typing.Optional[typing.Sequence[str]]
|
|
60
|
+
Skyflow IDs of the records to delete.
|
|
61
|
+
|
|
62
|
+
unique_values : typing.Optional[typing.Sequence[UniqueValue]]
|
|
63
|
+
List of unique constraint values to query records by data.
|
|
64
|
+
|
|
65
|
+
request_options : typing.Optional[RequestOptions]
|
|
66
|
+
Request-specific configuration.
|
|
67
|
+
|
|
68
|
+
Returns
|
|
69
|
+
-------
|
|
70
|
+
DeleteResponse
|
|
71
|
+
OK
|
|
72
|
+
|
|
73
|
+
Examples
|
|
74
|
+
--------
|
|
75
|
+
from skyflow import SkyflowAuth
|
|
76
|
+
|
|
77
|
+
client = SkyflowAuth(
|
|
78
|
+
token="YOUR_TOKEN",
|
|
79
|
+
)
|
|
80
|
+
client.records.delete_records(
|
|
81
|
+
vault_id="d408485953784308a000f8dcf81901ef",
|
|
82
|
+
)
|
|
83
|
+
"""
|
|
84
|
+
_response = self._raw_client.delete_records(
|
|
85
|
+
vault_id=vault_id,
|
|
86
|
+
table_name=table_name,
|
|
87
|
+
skyflow_i_ds=skyflow_i_ds,
|
|
88
|
+
unique_values=unique_values,
|
|
89
|
+
request_options=request_options,
|
|
90
|
+
)
|
|
91
|
+
return _response.data
|
|
92
|
+
|
|
93
|
+
def get_records(
|
|
94
|
+
self,
|
|
95
|
+
*,
|
|
96
|
+
vault_id: str,
|
|
97
|
+
table_name: typing.Optional[str] = OMIT,
|
|
98
|
+
skyflow_i_ds: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
99
|
+
column_redactions: typing.Optional[typing.Sequence[ColumnRedactions]] = OMIT,
|
|
100
|
+
columns: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
101
|
+
limit: typing.Optional[int] = OMIT,
|
|
102
|
+
offset: typing.Optional[int] = OMIT,
|
|
103
|
+
unique_values: typing.Optional[typing.Sequence[UniqueValue]] = OMIT,
|
|
104
|
+
records: typing.Optional[typing.Sequence[GetRequestData]] = OMIT,
|
|
105
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
106
|
+
) -> GetResponse:
|
|
107
|
+
"""
|
|
108
|
+
Returns the specified records from a vault.
|
|
109
|
+
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
vault_id : str
|
|
113
|
+
ID of the vault.
|
|
114
|
+
|
|
115
|
+
table_name : typing.Optional[str]
|
|
116
|
+
Name of the table to perform the operation on.
|
|
117
|
+
|
|
118
|
+
skyflow_i_ds : typing.Optional[typing.Sequence[str]]
|
|
119
|
+
Skyflow IDs of the records to return. Either `skyflowIDs` or `uniqueValues` are required. If both are provided, the request fails.
|
|
120
|
+
|
|
121
|
+
column_redactions : typing.Optional[typing.Sequence[ColumnRedactions]]
|
|
122
|
+
List of columns to redact.
|
|
123
|
+
|
|
124
|
+
columns : typing.Optional[typing.Sequence[str]]
|
|
125
|
+
List of columns to return.
|
|
126
|
+
|
|
127
|
+
limit : typing.Optional[int]
|
|
128
|
+
Limit for the number of records to be fetched.
|
|
129
|
+
|
|
130
|
+
offset : typing.Optional[int]
|
|
131
|
+
Offset for the number of records to be fetched.
|
|
132
|
+
|
|
133
|
+
unique_values : typing.Optional[typing.Sequence[UniqueValue]]
|
|
134
|
+
List of unique constraint values to query records by data.
|
|
135
|
+
|
|
136
|
+
records : typing.Optional[typing.Sequence[GetRequestData]]
|
|
137
|
+
List of records to be fetched. This field contains tableName and skyflowIDs belonging to the table.
|
|
138
|
+
|
|
139
|
+
request_options : typing.Optional[RequestOptions]
|
|
140
|
+
Request-specific configuration.
|
|
141
|
+
|
|
142
|
+
Returns
|
|
143
|
+
-------
|
|
144
|
+
GetResponse
|
|
145
|
+
OK
|
|
146
|
+
|
|
147
|
+
Examples
|
|
148
|
+
--------
|
|
149
|
+
from skyflow import SkyflowAuth
|
|
150
|
+
|
|
151
|
+
client = SkyflowAuth(
|
|
152
|
+
token="YOUR_TOKEN",
|
|
153
|
+
)
|
|
154
|
+
client.records.get_records(
|
|
155
|
+
vault_id="d408485953784308a000f8dcf81901ef",
|
|
156
|
+
)
|
|
157
|
+
"""
|
|
158
|
+
_response = self._raw_client.get_records(
|
|
159
|
+
vault_id=vault_id,
|
|
160
|
+
table_name=table_name,
|
|
161
|
+
skyflow_i_ds=skyflow_i_ds,
|
|
162
|
+
column_redactions=column_redactions,
|
|
163
|
+
columns=columns,
|
|
164
|
+
limit=limit,
|
|
165
|
+
offset=offset,
|
|
166
|
+
unique_values=unique_values,
|
|
167
|
+
records=records,
|
|
168
|
+
request_options=request_options,
|
|
169
|
+
)
|
|
170
|
+
return _response.data
|
|
171
|
+
|
|
172
|
+
def insert_records(
|
|
173
|
+
self,
|
|
174
|
+
*,
|
|
175
|
+
vault_id: str,
|
|
176
|
+
table_name: str,
|
|
177
|
+
records: typing.Sequence[InsertRecordData],
|
|
178
|
+
upsert: typing.Optional[Upsert] = OMIT,
|
|
179
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
180
|
+
) -> InsertResponse:
|
|
181
|
+
"""
|
|
182
|
+
Inserts new records into a vault.
|
|
183
|
+
|
|
184
|
+
Parameters
|
|
185
|
+
----------
|
|
186
|
+
vault_id : str
|
|
187
|
+
ID of the vault.
|
|
188
|
+
|
|
189
|
+
table_name : str
|
|
190
|
+
Name of the table to perform the operation on. Can be defined at both the request body level and individual record level. If provided at both levels, the record-level `tableName` takes precedence.
|
|
191
|
+
|
|
192
|
+
records : typing.Sequence[InsertRecordData]
|
|
193
|
+
Data to insert as a list of records.
|
|
194
|
+
|
|
195
|
+
upsert : typing.Optional[Upsert]
|
|
196
|
+
|
|
197
|
+
request_options : typing.Optional[RequestOptions]
|
|
198
|
+
Request-specific configuration.
|
|
199
|
+
|
|
200
|
+
Returns
|
|
201
|
+
-------
|
|
202
|
+
InsertResponse
|
|
203
|
+
OK
|
|
204
|
+
|
|
205
|
+
Examples
|
|
206
|
+
--------
|
|
207
|
+
from skyflow import InsertRecordData, SkyflowAuth
|
|
208
|
+
|
|
209
|
+
client = SkyflowAuth(
|
|
210
|
+
token="YOUR_TOKEN",
|
|
211
|
+
)
|
|
212
|
+
client.records.insert_records(
|
|
213
|
+
vault_id="d408485953784308a000f8dcf81901ef",
|
|
214
|
+
table_name="employees",
|
|
215
|
+
records=[
|
|
216
|
+
InsertRecordData(
|
|
217
|
+
data={
|
|
218
|
+
"name": "Vivek1",
|
|
219
|
+
"email": "vivek.varshney@skyflow.com",
|
|
220
|
+
"age": 23,
|
|
221
|
+
"adult": True,
|
|
222
|
+
"address": {
|
|
223
|
+
"street": "Bata Gali",
|
|
224
|
+
"city": "Aligarh",
|
|
225
|
+
"state": "UP",
|
|
226
|
+
"postal_code": 202001,
|
|
227
|
+
"country": "India",
|
|
228
|
+
"phone_numbers": [
|
|
229
|
+
{"type": "home", "number": [1234, 5678]},
|
|
230
|
+
{"type": "work", "number": [4321, 8765]},
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
),
|
|
235
|
+
InsertRecordData(
|
|
236
|
+
data={
|
|
237
|
+
"name": "Asad1",
|
|
238
|
+
"email": "asad.public@gmail.com",
|
|
239
|
+
"age": 16,
|
|
240
|
+
"adult": False,
|
|
241
|
+
"address": {
|
|
242
|
+
"street": "Sarojini",
|
|
243
|
+
"city": "Deoria",
|
|
244
|
+
"state": "UP",
|
|
245
|
+
"postal_code": 274001,
|
|
246
|
+
"country": "India",
|
|
247
|
+
"phone_numbers": [
|
|
248
|
+
{"type": "home", "number": [7890, 3456]},
|
|
249
|
+
{"type": "work", "number": [9087, 6543]},
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
),
|
|
254
|
+
],
|
|
255
|
+
)
|
|
256
|
+
"""
|
|
257
|
+
_response = self._raw_client.insert_records(
|
|
258
|
+
vault_id=vault_id, table_name=table_name, records=records, upsert=upsert, request_options=request_options
|
|
259
|
+
)
|
|
260
|
+
return _response.data
|
|
261
|
+
|
|
262
|
+
def update_records(
|
|
263
|
+
self,
|
|
264
|
+
*,
|
|
265
|
+
vault_id: str,
|
|
266
|
+
table_name: str,
|
|
267
|
+
records: typing.Sequence[UpdateRecordData],
|
|
268
|
+
update_type: typing.Optional[UpdateRequestUpdateType] = OMIT,
|
|
269
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
270
|
+
) -> UpdateResponse:
|
|
271
|
+
"""
|
|
272
|
+
Updates the specified records in a vault.
|
|
273
|
+
|
|
274
|
+
Parameters
|
|
275
|
+
----------
|
|
276
|
+
vault_id : str
|
|
277
|
+
ID of the vault.
|
|
278
|
+
|
|
279
|
+
table_name : str
|
|
280
|
+
Name of the table.
|
|
281
|
+
|
|
282
|
+
records : typing.Sequence[UpdateRecordData]
|
|
283
|
+
Data to update as a list of records.
|
|
284
|
+
|
|
285
|
+
update_type : typing.Optional[UpdateRequestUpdateType]
|
|
286
|
+
Type of update operation to perform.
|
|
287
|
+
|
|
288
|
+
request_options : typing.Optional[RequestOptions]
|
|
289
|
+
Request-specific configuration.
|
|
290
|
+
|
|
291
|
+
Returns
|
|
292
|
+
-------
|
|
293
|
+
UpdateResponse
|
|
294
|
+
OK
|
|
295
|
+
|
|
296
|
+
Examples
|
|
297
|
+
--------
|
|
298
|
+
from skyflow import SkyflowAuth, UpdateRecordData
|
|
299
|
+
|
|
300
|
+
client = SkyflowAuth(
|
|
301
|
+
token="YOUR_TOKEN",
|
|
302
|
+
)
|
|
303
|
+
client.records.update_records(
|
|
304
|
+
vault_id="d408485953784308a000f8dcf81901ef",
|
|
305
|
+
table_name="employees",
|
|
306
|
+
records=[
|
|
307
|
+
UpdateRecordData(
|
|
308
|
+
skyflow_id="97cdd1af-02ac-47eb-ab0d-8339dbef6ccb",
|
|
309
|
+
data={
|
|
310
|
+
"name": "Vivek",
|
|
311
|
+
"email": "asad.public5@gmail.com",
|
|
312
|
+
"age": 25,
|
|
313
|
+
"adult": True,
|
|
314
|
+
"address": {"city": "aligarh", "country": "India"},
|
|
315
|
+
},
|
|
316
|
+
),
|
|
317
|
+
UpdateRecordData(
|
|
318
|
+
skyflow_id="aed32bbc-e7a4-4c7b-8c88-7f52ce8cb066",
|
|
319
|
+
data={
|
|
320
|
+
"name": "Asad",
|
|
321
|
+
"email": "asad.public7@gmail.com",
|
|
322
|
+
"age": 24,
|
|
323
|
+
"adult": False,
|
|
324
|
+
"address": {"city": "deoria", "country": "India"},
|
|
325
|
+
},
|
|
326
|
+
),
|
|
327
|
+
],
|
|
328
|
+
)
|
|
329
|
+
"""
|
|
330
|
+
_response = self._raw_client.update_records(
|
|
331
|
+
vault_id=vault_id,
|
|
332
|
+
table_name=table_name,
|
|
333
|
+
records=records,
|
|
334
|
+
update_type=update_type,
|
|
335
|
+
request_options=request_options,
|
|
336
|
+
)
|
|
337
|
+
return _response.data
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class AsyncRecordsClient:
|
|
341
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
342
|
+
self._raw_client = AsyncRawRecordsClient(client_wrapper=client_wrapper)
|
|
343
|
+
|
|
344
|
+
@property
|
|
345
|
+
def with_raw_response(self) -> AsyncRawRecordsClient:
|
|
346
|
+
"""
|
|
347
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
348
|
+
|
|
349
|
+
Returns
|
|
350
|
+
-------
|
|
351
|
+
AsyncRawRecordsClient
|
|
352
|
+
"""
|
|
353
|
+
return self._raw_client
|
|
354
|
+
|
|
355
|
+
async def delete_records(
|
|
356
|
+
self,
|
|
357
|
+
*,
|
|
358
|
+
vault_id: str,
|
|
359
|
+
table_name: typing.Optional[str] = OMIT,
|
|
360
|
+
skyflow_i_ds: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
361
|
+
unique_values: typing.Optional[typing.Sequence[UniqueValue]] = OMIT,
|
|
362
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
363
|
+
) -> DeleteResponse:
|
|
364
|
+
"""
|
|
365
|
+
Deletes records from a vault.
|
|
366
|
+
|
|
367
|
+
Parameters
|
|
368
|
+
----------
|
|
369
|
+
vault_id : str
|
|
370
|
+
ID of the vault.
|
|
371
|
+
|
|
372
|
+
table_name : typing.Optional[str]
|
|
373
|
+
Name of the table.
|
|
374
|
+
|
|
375
|
+
skyflow_i_ds : typing.Optional[typing.Sequence[str]]
|
|
376
|
+
Skyflow IDs of the records to delete.
|
|
377
|
+
|
|
378
|
+
unique_values : typing.Optional[typing.Sequence[UniqueValue]]
|
|
379
|
+
List of unique constraint values to query records by data.
|
|
380
|
+
|
|
381
|
+
request_options : typing.Optional[RequestOptions]
|
|
382
|
+
Request-specific configuration.
|
|
383
|
+
|
|
384
|
+
Returns
|
|
385
|
+
-------
|
|
386
|
+
DeleteResponse
|
|
387
|
+
OK
|
|
388
|
+
|
|
389
|
+
Examples
|
|
390
|
+
--------
|
|
391
|
+
import asyncio
|
|
392
|
+
|
|
393
|
+
from skyflow import AsyncSkyflowAuth
|
|
394
|
+
|
|
395
|
+
client = AsyncSkyflowAuth(
|
|
396
|
+
token="YOUR_TOKEN",
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
async def main() -> None:
|
|
401
|
+
await client.records.delete_records(
|
|
402
|
+
vault_id="d408485953784308a000f8dcf81901ef",
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
asyncio.run(main())
|
|
407
|
+
"""
|
|
408
|
+
_response = await self._raw_client.delete_records(
|
|
409
|
+
vault_id=vault_id,
|
|
410
|
+
table_name=table_name,
|
|
411
|
+
skyflow_i_ds=skyflow_i_ds,
|
|
412
|
+
unique_values=unique_values,
|
|
413
|
+
request_options=request_options,
|
|
414
|
+
)
|
|
415
|
+
return _response.data
|
|
416
|
+
|
|
417
|
+
async def get_records(
|
|
418
|
+
self,
|
|
419
|
+
*,
|
|
420
|
+
vault_id: str,
|
|
421
|
+
table_name: typing.Optional[str] = OMIT,
|
|
422
|
+
skyflow_i_ds: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
423
|
+
column_redactions: typing.Optional[typing.Sequence[ColumnRedactions]] = OMIT,
|
|
424
|
+
columns: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
425
|
+
limit: typing.Optional[int] = OMIT,
|
|
426
|
+
offset: typing.Optional[int] = OMIT,
|
|
427
|
+
unique_values: typing.Optional[typing.Sequence[UniqueValue]] = OMIT,
|
|
428
|
+
records: typing.Optional[typing.Sequence[GetRequestData]] = OMIT,
|
|
429
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
430
|
+
) -> GetResponse:
|
|
431
|
+
"""
|
|
432
|
+
Returns the specified records from a vault.
|
|
433
|
+
|
|
434
|
+
Parameters
|
|
435
|
+
----------
|
|
436
|
+
vault_id : str
|
|
437
|
+
ID of the vault.
|
|
438
|
+
|
|
439
|
+
table_name : typing.Optional[str]
|
|
440
|
+
Name of the table to perform the operation on.
|
|
441
|
+
|
|
442
|
+
skyflow_i_ds : typing.Optional[typing.Sequence[str]]
|
|
443
|
+
Skyflow IDs of the records to return. Either `skyflowIDs` or `uniqueValues` are required. If both are provided, the request fails.
|
|
444
|
+
|
|
445
|
+
column_redactions : typing.Optional[typing.Sequence[ColumnRedactions]]
|
|
446
|
+
List of columns to redact.
|
|
447
|
+
|
|
448
|
+
columns : typing.Optional[typing.Sequence[str]]
|
|
449
|
+
List of columns to return.
|
|
450
|
+
|
|
451
|
+
limit : typing.Optional[int]
|
|
452
|
+
Limit for the number of records to be fetched.
|
|
453
|
+
|
|
454
|
+
offset : typing.Optional[int]
|
|
455
|
+
Offset for the number of records to be fetched.
|
|
456
|
+
|
|
457
|
+
unique_values : typing.Optional[typing.Sequence[UniqueValue]]
|
|
458
|
+
List of unique constraint values to query records by data.
|
|
459
|
+
|
|
460
|
+
records : typing.Optional[typing.Sequence[GetRequestData]]
|
|
461
|
+
List of records to be fetched. This field contains tableName and skyflowIDs belonging to the table.
|
|
462
|
+
|
|
463
|
+
request_options : typing.Optional[RequestOptions]
|
|
464
|
+
Request-specific configuration.
|
|
465
|
+
|
|
466
|
+
Returns
|
|
467
|
+
-------
|
|
468
|
+
GetResponse
|
|
469
|
+
OK
|
|
470
|
+
|
|
471
|
+
Examples
|
|
472
|
+
--------
|
|
473
|
+
import asyncio
|
|
474
|
+
|
|
475
|
+
from skyflow import AsyncSkyflowAuth
|
|
476
|
+
|
|
477
|
+
client = AsyncSkyflowAuth(
|
|
478
|
+
token="YOUR_TOKEN",
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
async def main() -> None:
|
|
483
|
+
await client.records.get_records(
|
|
484
|
+
vault_id="d408485953784308a000f8dcf81901ef",
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
asyncio.run(main())
|
|
489
|
+
"""
|
|
490
|
+
_response = await self._raw_client.get_records(
|
|
491
|
+
vault_id=vault_id,
|
|
492
|
+
table_name=table_name,
|
|
493
|
+
skyflow_i_ds=skyflow_i_ds,
|
|
494
|
+
column_redactions=column_redactions,
|
|
495
|
+
columns=columns,
|
|
496
|
+
limit=limit,
|
|
497
|
+
offset=offset,
|
|
498
|
+
unique_values=unique_values,
|
|
499
|
+
records=records,
|
|
500
|
+
request_options=request_options,
|
|
501
|
+
)
|
|
502
|
+
return _response.data
|
|
503
|
+
|
|
504
|
+
async def insert_records(
|
|
505
|
+
self,
|
|
506
|
+
*,
|
|
507
|
+
vault_id: str,
|
|
508
|
+
table_name: str,
|
|
509
|
+
records: typing.Sequence[InsertRecordData],
|
|
510
|
+
upsert: typing.Optional[Upsert] = OMIT,
|
|
511
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
512
|
+
) -> InsertResponse:
|
|
513
|
+
"""
|
|
514
|
+
Inserts new records into a vault.
|
|
515
|
+
|
|
516
|
+
Parameters
|
|
517
|
+
----------
|
|
518
|
+
vault_id : str
|
|
519
|
+
ID of the vault.
|
|
520
|
+
|
|
521
|
+
table_name : str
|
|
522
|
+
Name of the table to perform the operation on. Can be defined at both the request body level and individual record level. If provided at both levels, the record-level `tableName` takes precedence.
|
|
523
|
+
|
|
524
|
+
records : typing.Sequence[InsertRecordData]
|
|
525
|
+
Data to insert as a list of records.
|
|
526
|
+
|
|
527
|
+
upsert : typing.Optional[Upsert]
|
|
528
|
+
|
|
529
|
+
request_options : typing.Optional[RequestOptions]
|
|
530
|
+
Request-specific configuration.
|
|
531
|
+
|
|
532
|
+
Returns
|
|
533
|
+
-------
|
|
534
|
+
InsertResponse
|
|
535
|
+
OK
|
|
536
|
+
|
|
537
|
+
Examples
|
|
538
|
+
--------
|
|
539
|
+
import asyncio
|
|
540
|
+
|
|
541
|
+
from skyflow import AsyncSkyflowAuth, InsertRecordData
|
|
542
|
+
|
|
543
|
+
client = AsyncSkyflowAuth(
|
|
544
|
+
token="YOUR_TOKEN",
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
async def main() -> None:
|
|
549
|
+
await client.records.insert_records(
|
|
550
|
+
vault_id="d408485953784308a000f8dcf81901ef",
|
|
551
|
+
table_name="employees",
|
|
552
|
+
records=[
|
|
553
|
+
InsertRecordData(
|
|
554
|
+
data={
|
|
555
|
+
"name": "Vivek1",
|
|
556
|
+
"email": "vivek.varshney@skyflow.com",
|
|
557
|
+
"age": 23,
|
|
558
|
+
"adult": True,
|
|
559
|
+
"address": {
|
|
560
|
+
"street": "Bata Gali",
|
|
561
|
+
"city": "Aligarh",
|
|
562
|
+
"state": "UP",
|
|
563
|
+
"postal_code": 202001,
|
|
564
|
+
"country": "India",
|
|
565
|
+
"phone_numbers": [
|
|
566
|
+
{"type": "home", "number": [1234, 5678]},
|
|
567
|
+
{"type": "work", "number": [4321, 8765]},
|
|
568
|
+
],
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
),
|
|
572
|
+
InsertRecordData(
|
|
573
|
+
data={
|
|
574
|
+
"name": "Asad1",
|
|
575
|
+
"email": "asad.public@gmail.com",
|
|
576
|
+
"age": 16,
|
|
577
|
+
"adult": False,
|
|
578
|
+
"address": {
|
|
579
|
+
"street": "Sarojini",
|
|
580
|
+
"city": "Deoria",
|
|
581
|
+
"state": "UP",
|
|
582
|
+
"postal_code": 274001,
|
|
583
|
+
"country": "India",
|
|
584
|
+
"phone_numbers": [
|
|
585
|
+
{"type": "home", "number": [7890, 3456]},
|
|
586
|
+
{"type": "work", "number": [9087, 6543]},
|
|
587
|
+
],
|
|
588
|
+
},
|
|
589
|
+
},
|
|
590
|
+
),
|
|
591
|
+
],
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
asyncio.run(main())
|
|
596
|
+
"""
|
|
597
|
+
_response = await self._raw_client.insert_records(
|
|
598
|
+
vault_id=vault_id, table_name=table_name, records=records, upsert=upsert, request_options=request_options
|
|
599
|
+
)
|
|
600
|
+
return _response.data
|
|
601
|
+
|
|
602
|
+
async def update_records(
|
|
603
|
+
self,
|
|
604
|
+
*,
|
|
605
|
+
vault_id: str,
|
|
606
|
+
table_name: str,
|
|
607
|
+
records: typing.Sequence[UpdateRecordData],
|
|
608
|
+
update_type: typing.Optional[UpdateRequestUpdateType] = OMIT,
|
|
609
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
610
|
+
) -> UpdateResponse:
|
|
611
|
+
"""
|
|
612
|
+
Updates the specified records in a vault.
|
|
613
|
+
|
|
614
|
+
Parameters
|
|
615
|
+
----------
|
|
616
|
+
vault_id : str
|
|
617
|
+
ID of the vault.
|
|
618
|
+
|
|
619
|
+
table_name : str
|
|
620
|
+
Name of the table.
|
|
621
|
+
|
|
622
|
+
records : typing.Sequence[UpdateRecordData]
|
|
623
|
+
Data to update as a list of records.
|
|
624
|
+
|
|
625
|
+
update_type : typing.Optional[UpdateRequestUpdateType]
|
|
626
|
+
Type of update operation to perform.
|
|
627
|
+
|
|
628
|
+
request_options : typing.Optional[RequestOptions]
|
|
629
|
+
Request-specific configuration.
|
|
630
|
+
|
|
631
|
+
Returns
|
|
632
|
+
-------
|
|
633
|
+
UpdateResponse
|
|
634
|
+
OK
|
|
635
|
+
|
|
636
|
+
Examples
|
|
637
|
+
--------
|
|
638
|
+
import asyncio
|
|
639
|
+
|
|
640
|
+
from skyflow import AsyncSkyflowAuth, UpdateRecordData
|
|
641
|
+
|
|
642
|
+
client = AsyncSkyflowAuth(
|
|
643
|
+
token="YOUR_TOKEN",
|
|
644
|
+
)
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
async def main() -> None:
|
|
648
|
+
await client.records.update_records(
|
|
649
|
+
vault_id="d408485953784308a000f8dcf81901ef",
|
|
650
|
+
table_name="employees",
|
|
651
|
+
records=[
|
|
652
|
+
UpdateRecordData(
|
|
653
|
+
skyflow_id="97cdd1af-02ac-47eb-ab0d-8339dbef6ccb",
|
|
654
|
+
data={
|
|
655
|
+
"name": "Vivek",
|
|
656
|
+
"email": "asad.public5@gmail.com",
|
|
657
|
+
"age": 25,
|
|
658
|
+
"adult": True,
|
|
659
|
+
"address": {"city": "aligarh", "country": "India"},
|
|
660
|
+
},
|
|
661
|
+
),
|
|
662
|
+
UpdateRecordData(
|
|
663
|
+
skyflow_id="aed32bbc-e7a4-4c7b-8c88-7f52ce8cb066",
|
|
664
|
+
data={
|
|
665
|
+
"name": "Asad",
|
|
666
|
+
"email": "asad.public7@gmail.com",
|
|
667
|
+
"age": 24,
|
|
668
|
+
"adult": False,
|
|
669
|
+
"address": {"city": "deoria", "country": "India"},
|
|
670
|
+
},
|
|
671
|
+
),
|
|
672
|
+
],
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
asyncio.run(main())
|
|
677
|
+
"""
|
|
678
|
+
_response = await self._raw_client.update_records(
|
|
679
|
+
vault_id=vault_id,
|
|
680
|
+
table_name=table_name,
|
|
681
|
+
records=records,
|
|
682
|
+
update_type=update_type,
|
|
683
|
+
request_options=request_options,
|
|
684
|
+
)
|
|
685
|
+
return _response.data
|