A wrapper for the return value of a select. It basically represents a
table. It has an iterator and each row is represented as a
dictionary.
|
|
__init__(self,
db=None,
records=[],
colnames=[],
compact=True,
rawrows=None)
x.__init__(...) initializes x; see help(type(x)) for signature |
source code
|
|
|
|
|
|
|
setvirtualfields(self,
**keyed_virtualfields)
db.define_table('x',Field('number','integer'))
if db(db.x).isempty(): [db.x.insert(number=i) for i in range(10)] |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find(self,
f,
limitby=None)
returns a new Rows object, a subset of the original object, filtered
by the function f |
source code
|
|
|
|
exclude(self,
f)
removes elements from the calling Rows object, filtered by the
function f, and returns a new Rows object containing the removed
elements |
source code
|
|
|
|
sort(self,
f,
reverse=False)
returns a list of sorted elements (not sorted in place) |
source code
|
|
|
|
group_by_value(self,
*fields,
**args)
regroups the rows, by one of the fields |
source code
|
|
|
|
render(self,
i=None,
fields=None)
Takes an index and returns a copy of the indexed row with values
transformed via the "represent" attributes of the associated fields. |
source code
|
|
|
|
as_list(self,
compact=True,
storage_to_dict=True,
datetime_to_str=False,
custom_types=None)
returns the data as a list or dictionary. |
source code
|
|
|
|
as_dict(self,
key='id',
compact=True,
storage_to_dict=True,
datetime_to_str=False,
custom_types=None)
returns the data as a dictionary of dictionaries
(storage_to_dict=True) or records (False) |
source code
|
|
|
|
|
|
|
xml(self,
strict=False,
row_name='row',
rows_name='rows')
serializes the table using sqlhtml.SQLTABLE (if present) |
source code
|
|
|
|
as_xml(self,
row_name='row',
rows_name='rows') |
source code
|
|
|
|
as_json(self,
mode='object',
default=None)
serializes the rows to a JSON list or object with objects
mode='object' is not implemented (should return a nested object
structure) |
source code
|
|
|
|
as_csv(self)
serializes the table into a csv file |
source code
|
|
|
|
json(self,
mode='object',
default=None)
serializes the rows to a JSON list or object with objects
mode='object' is not implemented (should return a nested object
structure) |
source code
|
|
|
Inherited from object:
__delattr__,
__format__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__setattr__,
__sizeof__,
__subclasshook__
|