Installation
pip:
poetry:
Key-Value Store
The SDK can store and update key-value objects that can be called by custom Python scripts hosted on Definite. An example use case might be saving/retrieving replication state for a custom data connector.
Example:
from definite_sdk.client import DefiniteClient
DEFINITE_API_KEY = 'YOUR_API_KEY'
# initialize the client
client = DefiniteClient(DEFINITE_API_KEY)
# initialize or retrieve an existing key-value store
store = client.get_kv_store('test_store')
# add or update key-value pairs to the store
store['replication_key'] = 'created_at'
store['replication_state'] = '2024-05-20'
# commit the store changes
store.commit()
If you want to view the contents of a store
from definite_sdk.client import DefiniteClient
DEFINITE_API_KEY = 'YOUR_API_KEY'
client = DefiniteClient(DEFINITE_API_KEY)
# retrieve an existing store
store = client.get_kv_store('test_store')
print(store)
Which will output a dictionary object like:
{'replication_state': '2024-05-20', 'replication_key': 'create_date'}
Source Code
Github repo for the Definite SDK can be found here.