To get going with Shove and PostgreSQL is easy. Just create a "shove" user and database to experiment with. That's what I did at least, to keep it separate from everything else. Next, create a virtual environment and install shove. I had to install a couple dependencies after the fact, so here is a one-liner — pip install shove sqlalchemy psycopg2. And that's it, connect to PostgreSQL with your Python dictionary.
from shove import Shove
store = Shove("postgres://shove:shove@127.0.0.1/shove")
if __name__ == "__main__":
print 'Existing keys...'
print store.keys()
print 'Cleaning up...'
for key in store.keys():
del store[key]
print 'Storing a string...'
store['astring'] = 'foo'
print 'Storing a list...'
store['alist'] = [1,2,3,'4']
No comments :
Post a Comment