Package wsatools :: Package DbConnect :: Module Schema :: Class Table
[hide private]

Class Table

source code


A database table schema. Consists primarily of an ordered list of Attribute columns, a list of constraints, and a file group.

Nested Classes [hide private]
    Nested Error Exceptions
  NotFoundError
Exception thrown if a requested table is not in the schema file.
Instance Methods [hide private]
 
__init__(self)
Initialises an empty schema table object.
source code
int
__len__(self)
Returns: Number of columns in the table.
source code
int
getBytePos(self, colName='')
Returns: Position of the given column in the table in number of bytes.
source code
bool
isMfJoin(self)
Returns: True if this table can be joined with table Multiframe.
source code
str or None
primaryKey(self, alias='')
Returns: Primary key for the table expressed as a comma-separated list of attributes.
source code
str
createSQL(self)
Returns: Full SQL line to create the object.
source code

Inherited from _Schema: __cmp__, __str__, createCommand, dropSQL, parseName

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

Class Variables [hide private]
  identifier = 'TABLE'
SQL identifier for this type of database object.
  attribute = {}
Dictionary access to specific column attributes referenced by name.
  columns = []
Ordered list of table column attribute objects.
  constraints = []
List of constraints for this table.
  fileGroup = ''
Create table in this file group.
  _bytePos = None
Stores positions of each column in bytes.

Inherited from _Schema: name, releasable, schemaFileName

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initialises an empty schema table object.

Overrides: object.__init__

__len__(self)
(Length operator)

source code 
Returns: int
Number of columns in the table.

Note: Required to test against empty Table objects, with 'not' op.

getBytePos(self, colName='')

source code 
Parameters:
  • colName (str) - Name of column (case insensitive).
Returns: int
Position of the given column in the table in number of bytes. Returns table width if column not supplied and None if column not in table.

isMfJoin(self)

source code 
Returns: bool
True if this table can be joined with table Multiframe.

primaryKey(self, alias='')

source code 
Parameters:
  • alias (str) - Optionally append this alias to the attribute list.
Returns: str or None
Primary key for the table expressed as a comma-separated list of attributes. None is returned if no primary key.

createSQL(self)

source code 
Returns: str
Full SQL line to create the object.
Overrides: _Schema.createSQL