Package grassyknoll :: Package backend :: Package litesql :: Module TableMaker :: Class Table
[hide private]

Class Table

source code


description of a table
>>> table=Table('pants')
>>> table.size=Column(int, indexed=True)
>>> table.color=Column(unicode, indexed=True)
>>> table.bought_on=Column(datetime.date, optional=True)
>>> table.show()
CREATE TABLE pants (
__id__ text PRIMARY KEY NOT NULL,
bought_on date,
color text NOT NULL,
size integer NOT NULL)
CREATE INDEX idx_pants_color ON pants (color)
CREATE INDEX idx_pants_size ON pants (size)
>>> table.addMultiIndex('size', 'bought_on')
>>> table.addMultiIndex('color', 'size')
>>> table.addMultiIndex('size', 'color')
>>> table.show()
CREATE TABLE pants (
__id__ text PRIMARY KEY NOT NULL,
bought_on date,
color text NOT NULL,
size integer NOT NULL)
CREATE INDEX idx_pants_color ON pants (color)
CREATE INDEX idx_pants_size ON pants (size)
CREATE INDEX idx_pants_size_bought_on ON pants (size, bought_on)
CREATE INDEX idx_pants_color_size ON pants (color, size)
CREATE INDEX idx_pants_size_color ON pants (size, color)


Instance Methods [hide private]
 
__init__(self, name)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__setattr__(self, name, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
columns(self) source code
 
addMultiIndex(self, *colnames) source code
 
columnSQL(self) source code
 
tableSQL(self) source code
 
multiIndexSql(self, colnames) source code
 
build(self, func) source code
 
create(self, connection) source code
 
show(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

__setattr__(self, name, value)

source code 
x.__setattr__('name', value) <==> x.name = value
Overrides: object.__setattr__
(inherited documentation)

columns(self)

source code 
Decorators:
  • @property