diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb957c..2a20a8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## [1.15.0] - 2023-10-30 +## Added +- options tokens support for Get method. + ## [1.14.0] - 2023-09-29 ## Added - Support for different BYOT modes in Insert method. diff --git a/README.md b/README.md index 8313322..6cec137 100644 --- a/README.md +++ b/README.md @@ -525,6 +525,75 @@ Sample response: } ``` +### Get With Options + +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. + +```python +# options, indicates whether to return all fields in tokenized format. Defaults to 'false'. +options: GetOptions +``` + +```python +{ + 'records': [ + { + 'ids': [str], # List of Skyflow IDs. + 'table': str, # Name of table holding the data. + } + ] +} + +``` +Sample usage + +The following snippet shows how to use the `get()` method. + +```python +{ + 'records': [ + { + 'ids': ["56513264-fc45-41fa-9cb0-d1ad3602bc49","da26de53-95d5-4bdb-99db-8d8c66a35ff9"], + 'table': cards, + } + ] +} + +try: + client.update(records, GetOptions(True)) +except SkyflowError as e: + if e.data: + print(e.data) + else: + print(e) +``` + +Sample response: + +```python +{ + 'records': [ + { + 'fields': { + 'card_number': 'gAAAAABlP7XQtYljbTWNsXgyKeRm9d9ZyHSsH46EoVK6wQlS_Wi_zvLy78B3bwT07Nd2OdV8nhbkaqXuy210_zT7K4CfBMOAseVkcaq5Pf75zvb0cAJUiKc=', + 'cvv': 'gAAAAABlP7XQqAvgj3qbZv53JWgIzaDAtqmDhZikmiNFNNcogH6zKOqDbCZD_pX_ARme3RLETZdgX-zW1e5h311QwTDTahh9RQ==', + 'skyflow_id': 'gAAAAABlP7XQPX0tL6PMf1nW3sqNSvyMQ7fJkFSIKLGci03vTV5EC8ZIGJhfjIOx7bvZcqreeScjNZQnnUi4k1YEyyQAaqqBoz7EpVGTbUrllp6BUXvKIC8LIj_nBWF-L1XrLd5i7ZXk' + }, + 'table': 'cards' + }, + { + 'fields': { + 'card_number': 'gAAAAABlP7aUxdtn5M0hmOhQ_1kxe0QE58JGrbX4oZ8GL24LUapmgxaDFyPtjVnsl7g9-eFbGJHOSLzt5FjNEFi9JTnix_fkOK9lHuJtxwvExdBwf747g-s=', + 'cvv': 'gAAAAABlP7aUAlbDCrQ8SvSurH1NJjiI0yYXLtRCJeTpuGRGo03eBr8f6gaSL9cYbr9k1UCNm8SMoD2ehpu472897LjfuI6kKw==', + 'skyflow_id': 'gAAAAABlP7aU8whfXOeZAEtwNmRBDjvHWFmKazJbQ0zxJDwPJJhknXhPSl6FpE0g-j-23XranpxTc3_qsRaTIsM_D_llgrNfXtyVFbB55KEwmd7c1RguFoeXbaCYFOl1XHZIR8rjXvup' + }, + 'table': 'cards' + } + ], + 'errors': [] +} +``` + ### Get By Id 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: