diff --git a/docs/api.rst b/docs/api.rst index bf4b64b..5df5ce9 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -17,4 +17,4 @@ Table .. autoclass:: dataset.Table :members: columns, drop, insert, update, upsert, find, find_one, distinct, create_column, create_index, all - :special-members: + :special-members: __len__, __iter__ diff --git a/docs/index.rst b/docs/index.rst index b160da6..a3d366f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,7 +12,7 @@ dataset: databases for lazy people Although managing data in relational database has plenty of benefits, we find them rarely being used in the typical day-to-day work with small to medium scale datasets. But why is that? Why do we see an awful lot of data stored in static files in CSV or JSON format? -Because **programmers are lazy** they tend to prefer the easiest solution they find. And in **Python**, managing data in a databases simply wasn't the simplest solution to store a bunch of structured data. This is where **dataset** steps in! +Because **programmers are lazy** they tend to prefer the easiest solution they find. And in **Python**, databases weren't the simplest solution to store a bunch of structured data. This is what **dataset** is going to change! *In short, dataset makes reading and writing data in databases as simple as reading and writing JSON files.* diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 47810e1..2e65d73 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -74,13 +74,18 @@ Now let's get some real data out of the table:: users = db['user'].all() -Searching for specific entries:: +If we simply want to iterate over all rows in a table, we can ommit :py:meth:`all() `:: + + for user in db['user']: + print user['email'] + +We can search for specific entries using :py:meth:`find() ` and :py:meth:`find_one() `:: # All users from China users = table.find(country='China') # Get a specific user - john = table.find_one(email='john.doe@example.org') + john = table.find_one(name='John Doe') Using :py:meth:`distinct() ` we can grab a set of rows with unique values in one or more columns::