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

Class S3Joins

source code

object --+
         |
        S3Joins

A collection of joins

Instance Methods
 
__init__(self, tablename, joins=None)
Constructor
source code
 
__iter__(self)
Iterate over the names of all joined tables in the collection
source code
 
__getitem__(self, tablename)
Get the list of joins for a table
source code
 
__setitem__(self, tablename, joins)
Update the joins for a table
source code
 
__len__(self)
Return the number of tables in the join, for boolean test of this instance ("if joins:")
source code
 
keys(self)
Get a list of names of all joined tables
source code
 
items(self)
Get a list of tuples (tablename, [joins]) for all joined tables
source code
 
values(self)
Get a list of joins for all joined tables
source code
 
add(self, joins)
Add joins to this collection
source code
 
extend(self, other)
Extend this collection with the joins from another collection
source code
 
__repr__(self)
String representation of this collection
source code
 
as_list(self, tablenames=None, aqueries=None, prefer=None)
Return joins from this collection as list
source code

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

Class Methods
 
sort(cls, joins)
Sort a list of left-joins by their interdependency
source code
Properties

Inherited from object: __class__

Method Details

__init__(self, tablename, joins=None)
(Constructor)

source code 

Constructor

Parameters:
  • tablename - the name of the master table
  • joins - list of joins
Overrides: object.__init__

__iter__(self)

source code 

Iterate over the names of all joined tables in the collection

__getitem__(self, tablename)
(Indexing operator)

source code 

Get the list of joins for a table

Parameters:
  • tablename - the tablename

__setitem__(self, tablename, joins)
(Index assignment operator)

source code 

Update the joins for a table

Parameters:
  • tablename - the tablename
  • joins - the list of joins for this table

__len__(self)
(Length operator)

source code 

Return the number of tables in the join, for boolean test of this instance ("if joins:")

keys(self)

source code 

Get a list of names of all joined tables

items(self)

source code 

Get a list of tuples (tablename, [joins]) for all joined tables

values(self)

source code 

Get a list of joins for all joined tables

Returns:
a nested list like [[join, join, ...], ...]

add(self, joins)

source code 

Add joins to this collection

Parameters:
  • joins - a join or a list/tuple of joins
Returns:
the list of names of all tables for which joins have been added to the collection

extend(self, other)

source code 

Extend this collection with the joins from another collection

Parameters:
  • other - the other collection (S3Joins), or a dict like {tablename: [join, join]}
Returns:
the list of names of all tables for which joins have been added to the collection

__repr__(self)
(Representation operator)

source code 

String representation of this collection

Overrides: object.__repr__

as_list(self, tablenames=None, aqueries=None, prefer=None)

source code 

Return joins from this collection as list

Parameters:
  • tablenames - the names of the tables for which joins shall be returned, defaults to all tables in the collection. Dependencies will be included automatically (if available)
  • aqueries - dict of accessible-queries {tablename: query} to include in the joins; if there is no entry for a particular table, then it will be looked up from current.auth and added to the dict. To prevent differential authorization of a particular joined table, set {<tablename>: None} in the dict
  • prefer - If any table or any of its dependencies would be joined by this S3Joins collection, then skip this table here (and enforce it to be joined by the preferred collection), to prevent duplication of left joins as inner joins: join = inner_joins.as_list(prefer=left_joins) left = left_joins.as_list()
Returns:
a list of joins, ordered by their interdependency, which can be used as join/left parameter of Set.select()

sort(cls, joins)
Class Method

source code 

Sort a list of left-joins by their interdependency

Parameters:
  • joins - the list of joins