updated documentation
This commit is contained in:
parent
258e3f3059
commit
5e5b902116
@ -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__
|
||||
|
||||
@ -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.*
|
||||
|
||||
|
||||
@ -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() <dataset.Table.all>`::
|
||||
|
||||
for user in db['user']:
|
||||
print user['email']
|
||||
|
||||
We can search for specific entries using :py:meth:`find() <dataset.Table.find>` and :py:meth:`find_one() <dataset.Table.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() <dataset.Table.distinct>` we can grab a set of rows with unique values in one or more columns::
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user