Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff61c5c

Browse files
committed
SK-1308 Merge with branch 'main'
2 parents 19d9668 + a3ce588 commit ff61c5c

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.15.0] - 2023-10-30
6+
## Added
7+
- options tokens support for Get method.
8+
59
## [1.14.0] - 2023-09-29
610
## Added
711
- Support for different BYOT modes in Insert method.

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,14 @@ Sample response:
429429

430430
### Get
431431

432-
To retrieve data using Skyflow IDs or unique column values, use the `get(records: dict)` method. The `records` parameter takes a Dictionary that contains either an array of Skyflow IDs or a unique column name and values.
432+
To retrieve data using Skyflow IDs or unique column values, use the `get(records: dict,options: GetOptions)` method. The `records` parameter takes a Dictionary that contains either an array of Skyflow IDs or a unique column name and values.The second parameter options is a GetOptions object that retrieves tokens of Skyflow IDs.
433433

434-
Note: You can use either Skyflow IDs or `unique` values to retrieve records. You can't use both at the same time.
434+
Note:
435+
436+
- You can use either Skyflow IDs or `unique` values to retrieve records. You can't use both at the same time.
437+
- GetOptions parameter applicable only for retrieving tokens using Skyflow ID.
438+
- You can't pass GetOptions along with the redaction type.
439+
- `tokens` defaults to false.
435440

436441
```python
437442
{
@@ -525,6 +530,55 @@ Sample response:
525530
}
526531
```
527532

533+
The following snippet shows how to use the `get()` method with GetOptions.
534+
535+
```python
536+
from skyflow.vault import GetOptions
537+
538+
{
539+
'records': [
540+
{
541+
'ids': ['56513264-fc45-41fa-9cb0-d1ad3602bc49','da26de53-95d5-4bdb-99db-8d8c66a35ff9'],
542+
'table': 'cards',
543+
}
544+
]
545+
}
546+
547+
try:
548+
client.get(records, GetOptions(True))
549+
except SkyflowError as e:
550+
if e.data:
551+
print(e.data)
552+
else:
553+
print(e)
554+
```
555+
556+
Sample response:
557+
558+
```python
559+
{
560+
'records': [
561+
{
562+
'fields': {
563+
'card_number': '4555-5176-5936-1930',
564+
'cvv': '6ad5f708-2061-453e-9491-618a1f29a688',
565+
'skyflow_id': '56513264-fc45-41fa-9cb0-d1ad3602bc49'
566+
},
567+
'table': 'cards'
568+
},
569+
{
570+
'fields': {
571+
'card_number': '8882-7418-2776-6660',
572+
'cvv': '25260679-e339-4b33-a5b0-c8b08df77af7',
573+
'skyflow_id': 'da26de53-95d5-4bdb-99db-8d8c66a35ff9'
574+
},
575+
'table': 'cards'
576+
}
577+
],
578+
'errors': []
579+
}
580+
```
581+
528582
### Get By Id
529583

530584
For retrieving using SkyflowID's, use the get_by_id(records: dict) method. The records parameter takes a Dictionary that contains records to be fetched as shown below:

samples/get_sample.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'''
44
from skyflow.errors import SkyflowError
55
from skyflow.service_account import generate_bearer_token, is_expired
6-
from skyflow.vault import Client, Configuration, RedactionType
6+
from skyflow.vault import Client, Configuration, RedactionType, GetOptions
77

88

99
# cache token for reuse
@@ -22,6 +22,8 @@ def token_provider():
2222
'<YOUR_VAULT_ID>', '<YOUR_VAULT_URL>', token_provider)
2323
client = Client(config)
2424

25+
options = GetOptions(False)
26+
2527
data = {"records": [
2628
{
2729
"ids": ["<SKYFLOW_ID1>", "<SKYFLOW_ID2>", "<SKYFLOW_ID3>"],
@@ -37,7 +39,7 @@ def token_provider():
3739
}
3840
]}
3941

40-
response = client.get(data)
42+
response = client.get(data,options=options)
4143
print('Response:', response)
4244
except SkyflowError as e:
4345
print('Error Occurred:', e)

0 commit comments

Comments
 (0)