Package wsatools :: Package DbConnect :: Module DbSession :: Class SelectSQL
[hide private]

Class SelectSQL

source code


Defines an SQL select statement. Initialise with components of an SQL query and then the SQL select line is returned when you convert the object to a string. Primarily used as part of the WHERE clause of another SQL statement.

Instance Methods [hide private]
 
__init__(self, select, table, where='', orderBy='', groupBy='')
Defines an SQL select statement from the given components.
source code
str
__str__(self)
Returns: The SQL select statement line.
source code

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

Static Methods [hide private]
 
replaceDerivTables(fromStr)
Replaces tables derived from a sub-query in the SQL script's FROM string, so that the class can parse the information correctly.
source code
Class Variables [hide private]
  tables = None
Dictionary of table names referenced by alias.
  selectStr = ''
SQL SELECT statement
  fromStr = ''
SQL FROM statement
  whereStr = ''
SQL WHERE clause statement
  orderByStr = ''
SQL ORDER BY statement
  groupByStr = ''
SQL GROUP BY statement
  _sql = ''
The full SQL select query statement line.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, select, table, where='', orderBy='', groupBy='')
(Constructor)

source code 

Defines an SQL select statement from the given components.

Parameters:
  • select (str) - SQL SELECT string; comma-separated column names.
  • table (str or Join) - SQL FROM string; single table name or Join object.
  • where (str) - Optional SQL WHERE clause.
  • orderBy (str) - Optional SQL ORDER BY statement.
  • groupBy (str) - Optional SQL GROUP BY statement.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

str(x)

Returns: str
The SQL select statement line.
Overrides: object.__str__