doc
This commit is contained in:
parent
4bbaa7ba00
commit
74ef6e8999
@ -6,6 +6,50 @@
|
||||
Welcome to dataset's documentation!
|
||||
===================================
|
||||
|
||||
Simple API::
|
||||
|
||||
import dataset
|
||||
# open a sqlite database (or create one if it doesn't exist yet)
|
||||
db = dataset.connect('sqlite:///factbook.db')
|
||||
|
||||
# get a wrapper for the table 'population'
|
||||
# this will create the table if it doesn't exist yet
|
||||
table = db['population']
|
||||
|
||||
# insert a new row (and also create the columns if they don't exist yet)
|
||||
table.insert(dict(country='China', year=2012, population=1354040000))
|
||||
table.insert(dict(country='India', year=2011, population=1210193422))
|
||||
|
||||
# you can easily add new columns at any time
|
||||
table.insert(dict(country='United States', year=2013, population=315591999, source='http://www.census.gov'))
|
||||
|
||||
.. autofunction:: dataset.connect
|
||||
|
||||
Database
|
||||
========
|
||||
|
||||
A Database is a simple wrapper around SQLAlchemy engines. Most of the time you want to use it to get instances to tables using *get_table* or the short-hand dict syntax::
|
||||
|
||||
# both statements return the same table
|
||||
table = db['population']
|
||||
table = db.get_table('population')
|
||||
|
||||
.. autoclass:: dataset.Database
|
||||
:members: get_table, create_table, load_table, query
|
||||
:undoc-members:
|
||||
|
||||
|
||||
|
||||
Table
|
||||
=====
|
||||
|
||||
Using the *Table* class you can easily store and retreive data from database tables.
|
||||
|
||||
.. autoclass:: dataset.Table
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
|
||||
Loading…
Reference in New Issue
Block a user