Skip to main content

official Python connector for GetSetDB

Project description


Python connector for GetSetDB with official support.

Some familiarity with GetSetDB would come a long way in using getsetpy as most of the API calls by the space.Space and database.Database inter-actors comes directly from it. To learn GetSetDB, refer to A Tour of GetSetDB


$ pip install getsetpy


getsetpy provides an interface to GetSetDB by using inter-actors that provide a similar and easy to use API for sending commands to the Space or a particular Database.

Space API

To run Space commands, use the space.Space inter-actor -

from import Space

space = Space()
databases = # returns list of all databases'users') # creates a new database
space.delete('old_database') # deletes an old database

space.rename('users', 'people') # renames 'user' database to 'people'

commands = space.commands() # returns a list of commands for "space"

Database API

To run commands for a specific Database, use the database.Database inter-actor -

from getsetpy.database import Database

# connects to the 'users' database
users = Database('users') 
# if it does not exist, it raises a DatabaseNotFound exception

# returns a dictionary with all the user keys as values and a redundant number as the key
users = users.all() 
# returns an empty dictionary if no pairs are found
# but if the users database was populated like this - 
# manan : yadav
# bruce : wayne
# martha : stewart
# kunal : pahuja
# peter : parker
# donald : trump
# barry : allen
# sheldon : cooper
# then the dictionary would look like
# {1.0: 'manan', 2.0: 'bruce', 3.0: 'martha', 4.0: 'kunal', 5.0: 'peter', 6.0: 'donald', 7.0: 'barry', 8.0: 'sheldon'}

# deletes the pair - donald : trump to database 'users'

# gets the value for key 'barry'
# 'allen'

# adds the pair - wonder : woman to database 'users'
users.set('wonder', 'woman')

# returns a dictionary containg info about the database 'users'
# like its size in bytes and the path to its file
# {'size': '136 bytes', 'path': '/tmp/gsdb/users.gsdb'}

# returns the number of pairs in the 'users' database
# 8

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for getsetpy, version 1.2.1
Filename, size File type Python version Upload date Hashes
Filename, size getsetpy-1.2.1-py3-none-any.whl (7.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size getsetpy-1.2.1.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page