summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Vasile <james@jamesvasile.com>2013-02-10 21:01:54 -0500
committerJames Vasile <james@jamesvasile.com>2013-02-10 21:01:54 -0500
commit61bc2a440e63c317c5e9910849442e0f3daf2953 (patch)
tree5e77da525fa73fef7103a024eeb4401d9c14edd8
parent2e90700429254bb32a9a16aa5555f3997128bc0c (diff)
formatting readme
-rw-r--r--README.mdwn28
1 files changed, 17 insertions, 11 deletions
diff --git a/README.mdwn b/README.mdwn
index 053d4ea..052133b 100644
--- a/README.mdwn
+++ b/README.mdwn
@@ -1,3 +1,5 @@
+# withsqlite
+
withsqlite - uses an sqlite db as a back end for a dict-like object,
kind of like shelve but with json and sqlite3.
@@ -13,7 +15,8 @@ This file was developed as part of planeteria <http://github.com/jvasile/planete
Backends a dict on an sqlite db. This class aims to present like a
dict wherever it can.
-USE:
+# USE
+
import sqlite_db from withsqlite
with sqlite_db("filename") as db:
db['aaa'] = {'test':'ok'}
@@ -30,24 +33,27 @@ state of the sqlite database. Changes are committed to disk when you
close the database connection, manually call commit, or (if you've set
autocommit to True) after each assignment.
-BUGS:
+# BUGS:
vals are json serialized before being written, so if you can't
serialize it, you can't put it in the dict.
Unimplemented mapping API:
-a.copy() a (shallow) copy of a
-a.update([b]) updates a with key/value pairs from b, overwriting existing keys, returns None
-a.fromkeys(seq[, value]) Creates a new dictionary with keys from seq and values set to value
-a.setdefault(k[, x]) a[k] if k in a, else x (also setting it)
-a.pop(k[, x]) a[k] if k in a, else x (and remove k)
-a.popitem() remove and return an arbitrary (key, value) pair
-a.iteritems() return an iterator over (key, value) pairs
-a.iterkeys() return an iterator over the mapping's keys
-a.itervalues() return an iterator over the mapping's values
+
+ a.copy() a (shallow) copy of a
+ a.update([b]) updates a with key/value pairs from b, overwriting existing keys, returns None
+ a.fromkeys(seq[, value]) Creates a new dictionary with keys from seq and values set to value
+ a.setdefault(k[, x]) a[k] if k in a, else x (also setting it)
+ a.pop(k[, x]) a[k] if k in a, else x (and remove k)
+ a.popitem() remove and return an arbitrary (key, value) pair
+ a.iteritems() return an iterator over (key, value) pairs
+ a.iterkeys() return an iterator over the mapping's keys
+ a.itervalues() return an iterator over the mapping's values
TODO: implement that mapping API
+# Examples
+
>>> with sqlite_db("test") as db:
... db.clear()
... db.items()