October 2014
Beginner to intermediate
348 pages
6h 55m
English
Dataset is a Python library, which is basically a wrapper around SQLAlchemy. It claims to be so easy to use that even lazy people like it.
Install dataset as follows:
$ sudo pip install dataset $ pip freeze|grep dataset dataset==0.5.4
Create a SQLite in-memory database and connect to it:
import dataset
db = dataset.connect('sqlite:///:memory:')Create a table called books:
table = db["books"]
Actually, the table in the database isn't created yet, since we haven't specified any columns. We only created a related object. The table schema is created automatically from calls to the insert() method. Give the insert() method dictionaries with book titles:
table.insert(dict(title="NumPy Beginner's Guide", author='Ivan Idris')) ...
Read now
Unlock full access