docs!
This commit is contained in:
parent
f52c7da45b
commit
f8e6d53bb5
@ -38,7 +38,11 @@ class Table(object):
|
|||||||
matching the name of a column to be created, and the given
|
matching the name of a column to be created, and the given
|
||||||
SQLAlchemy column type will be used. Otherwise, the type is
|
SQLAlchemy column type will be used. Otherwise, the type is
|
||||||
guessed from the row's value, defaulting to a simple unicode
|
guessed from the row's value, defaulting to a simple unicode
|
||||||
field. """
|
field.
|
||||||
|
::
|
||||||
|
data = dict(id=10, title='I am a banana!')
|
||||||
|
table.insert(data, ['id'])
|
||||||
|
"""
|
||||||
if ensure:
|
if ensure:
|
||||||
self._ensure_columns(row, types=types)
|
self._ensure_columns(row, types=types)
|
||||||
self.database.engine.execute(self.table.insert(row))
|
self.database.engine.execute(self.table.insert(row))
|
||||||
@ -133,7 +137,7 @@ class Table(object):
|
|||||||
return idx
|
return idx
|
||||||
|
|
||||||
def find_one(self, **filter):
|
def find_one(self, **filter):
|
||||||
"""Works just like :py:meth:`find() <dataset.Table.find>` but returns only the first result.
|
"""Works just like :py:meth:`find() <dataset.Table.find>` but returns only one result.
|
||||||
::
|
::
|
||||||
row = table.find_one(country='United States')
|
row = table.find_one(country='United States')
|
||||||
"""
|
"""
|
||||||
@ -157,6 +161,9 @@ class Table(object):
|
|||||||
results = table.find(country='France', year=1980)
|
results = table.find(country='France', year=1980)
|
||||||
# just return the first 10 rows
|
# just return the first 10 rows
|
||||||
results = table.find(country='France', _limit=10)
|
results = table.find(country='France', _limit=10)
|
||||||
|
|
||||||
|
You can sort the results by single or multiple columns. For descending order
|
||||||
|
please append a minus sign to the column name::
|
||||||
# sort results by a column 'year'
|
# sort results by a column 'year'
|
||||||
results = table.find(country='France', order_by='year')
|
results = table.find(country='France', order_by='year')
|
||||||
# return all rows sorted by multiple columns (by year in descending order)
|
# return all rows sorted by multiple columns (by year in descending order)
|
||||||
|
|||||||
8
docs/_themes/kr/static/flasky.css_t
vendored
8
docs/_themes/kr/static/flasky.css_t
vendored
@ -350,13 +350,13 @@ pre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dl pre, blockquote pre, li pre {
|
dl pre, blockquote pre, li pre {
|
||||||
margin-left: -60px;
|
margin-left: 0px;
|
||||||
padding-left: 60px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl dl pre {
|
dl dl pre {
|
||||||
margin-left: -90px;
|
margin-left: 0px;
|
||||||
padding-left: 90px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
tt {
|
tt {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user