from pgkv import Store
store = Store(
host='127.0.0.1',
namespace='pgkv', # database
username='postgres',
password='postgres',
port=5432,
)
# Put
store.put('table_1', 'key_1', 'value_1')
# Put many
store.put('table_1', kv_pairs=[('key_1', 'value_1'), ('key_2', 'value_2')])
# Get
value = store.get('table_1', 'key_1')
# Exists
store.exists('table_1', 'key_1')
# Scan
for value in store.scan(
'table_1',
start_key='key_0', # default: None
stop_key='key_f', # default: None
# limit=10, # default: None
# order_by_timestamp=True, # default: False
# order_by='value', # default: 'key'
order='desc' # or -1, default: 'asc'
):
print(value)
generated from labteral/python-package
-
Notifications
You must be signed in to change notification settings - Fork 0
PostgreSQL as a key-value store
License
labteral/pgkv
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
PostgreSQL as a key-value store
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published