Package s3 :: Module s3query :: Class S3ResourceQuery
[frames] | no frames]

Class S3ResourceQuery

source code

object --+
         |
        S3ResourceQuery


Helper class representing a resource query
- unlike DAL Query objects, these can be converted to/from URL filters

Instance Methods
 
__init__(self, op, left=None, right=None)
Constructor
source code
 
__and__(self, other)
AND
source code
 
__or__(self, other)
OR
source code
 
__invert__(self)
NOT
source code
 
fields(self)
Get all field selectors involved with this query
source code
 
split(self, resource)
Split this query into a real query and a virtual one (AND)
source code
 
transform(self, resource)
Placeholder for transformation method
source code
 
query(self, resource)
Convert this S3ResourceQuery into a DAL query, ignoring virtual fields (the necessary joins for this query can be constructed with the joins() method)
source code
 
__call__(self, resource, row, virtual=True)
Probe whether the row matches the query
source code
 
represent(self, resource)
Represent this query as a human-readable string.
source code
 
serialize_url(self, resource=None)
Serialize this query as URL query
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  NOT = "not"
  AND = "and"
  OR = "or"
  LT = "lt"
  LE = "le"
  EQ = "eq"
  NE = "ne"
  GE = "ge"
  GT = "gt"
  LIKE = "like"
  BELONGS = "belongs"
  CONTAINS = "contains"
  ANYOF = "anyof"
  TYPEOF = "typeof"
  INTERSECTS = "intersects"
  COMPARISON = [LT, LE, EQ, NE, GE, GT, LIKE, BELONGS, CONTAINS,...
  OPERATORS = [NOT, AND, OR]+ COMPARISON
Properties

Inherited from object: __class__

Method Details

__init__(self, op, left=None, right=None)
(Constructor)

source code 

Constructor

Overrides: object.__init__

__and__(self, other)
(And operator)

source code 

AND

__or__(self, other)
(Or operator)

source code 

OR

__invert__(self)

source code 

NOT

fields(self)

source code 

Get all field selectors involved with this query

split(self, resource)

source code 

Split this query into a real query and a virtual one (AND)

Parameters:
  • resource - the S3Resource
Returns:
tuple (DAL-translatable sub-query, virtual filter), both S3ResourceQuery instances

transform(self, resource)

source code 

Placeholder for transformation method

Parameters:
  • resource - the S3Resource

query(self, resource)

source code 

Convert this S3ResourceQuery into a DAL query, ignoring virtual fields (the necessary joins for this query can be constructed with the joins() method)

Parameters:
  • resource - the resource to resolve the query against

__call__(self, resource, row, virtual=True)
(Call operator)

source code 

Probe whether the row matches the query

Parameters:
  • resource - the resource to resolve the query against
  • row - the DB row
  • virtual - execute only virtual queries

represent(self, resource)

source code 

Represent this query as a human-readable string.

Parameters:
  • resource - the resource to resolve the query against

serialize_url(self, resource=None)

source code 

Serialize this query as URL query

Returns:
a Storage of URL variables

Class Variable Details

NOT

Value:
"not"

AND

Value:
"and"

OR

Value:
"or"

LT

Value:
"lt"

LE

Value:
"le"

EQ

Value:
"eq"

NE

Value:
"ne"

GE

Value:
"ge"

GT

Value:
"gt"

LIKE

Value:
"like"

BELONGS

Value:
"belongs"

CONTAINS

Value:
"contains"

ANYOF

Value:
"anyof"

TYPEOF

Value:
"typeof"

INTERSECTS

Value:
"intersects"

COMPARISON

Value:
[LT, LE, EQ, NE, GE, GT, LIKE, BELONGS, CONTAINS, ANYOF, TYPEOF, INTER\
SECTS]

OPERATORS

Value:
[NOT, AND, OR]+ COMPARISON