<query> query the database
- name
- query
- xml namespace
- http://moyaproject.com/db
Query the database. Will return a query set object that may be iterated over by default, unless 'collect'
is specified.
Example
<db:query model="#Post" dst="posts" orderby="-published_date"
filter="#Post.published_date gte start and #Post.published_date lt start.next_month"/>
<db:query model="#Session" let:session_key=".request.cookies.authsession" action="delete"/>
<db:query model="#Topic" filter="#Topic.promoted == yes" orderby="#Topic.title" dst="promoted_topics"/>
attributes
name |
purpose |
type |
required? |
default |
choices |
action |
Action to perform on query |
text |
No |
|
count
delete
exists
|
collect |
Collect results? |
text |
No |
|
dict
dict_sequence
list
set
|
collectkey |
Collect key if collect is True |
text |
No |
|
|
columns |
Columns to return, if model is not specified |
database expression |
No |
|
|
db |
Database |
text |
No |
"_default" |
|
distinct |
Make query distinct (remove duplicates from results)? |
boolean |
No |
no |
|
filter |
Filter expression |
database expression |
No |
|
|
flat |
Flatten results in to a list? |
boolean |
No |
no |
|
forupdate |
Issue a select FOR UPDATE? |
boolean |
No |
no |
|
from |
Model app |
application reference |
No |
|
|
groupby |
Group by column(s) |
comma list |
No |
|
|
join |
Join expressions |
database expression |
No |
|
|
maxresults |
Maximum number of items to return |
expression |
No |
None |
|
model |
Model |
text |
No |
|
|
orderby |
Order by |
comma list |
No |
|
|
reverse |
Reverse order? |
expression |
No |
no |
|
src |
Source query, if further query operations are required |
expression |
No |
None |
|
start |
Start index |
expression |
No |
None |
|
inherited attributes
name |
purpose |
type |
required? |
default |
choices |
dst |
Destination |
reference |
No |
|
|
if |
Conditional expression |
expression |
No |
yes |
|
value |
Value |
expression |
No |
None |
|