Package rrlog :: Package server :: Module dbwriter_sa :: Class DBConfig
[hide private]
[frames] | no frames]

Class DBConfig

source code

object --+    
         |    
 _Coltypes --+
             |
            DBConfig

Nested Classes [hide private]

Inherited from _Coltypes: Integer, String

Instance Methods [hide private]
 
__init__(self, engineStr, tablename, drop=True, cols=None)
@param engineStr: SQLAlchemy engine str @param tablename: str @param drop: If False, an eventually existing table is not deleted but extended.
source code

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

Class Variables [hide private]
  COLS_DEFAULT = (('pid', <class 'sqlalchemy.types.Integer'>), (...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, engineStr, tablename, drop=True, cols=None)
(Constructor)

source code 

@param engineStr: SQLAlchemy engine str
@param tablename: str
@param drop: If False, an eventually existing table is not deleted but extended. Only true makes sense with rotation.
@param cols: Specifies all log table column names and types.
 default=None. If None, the DBConfig.COLS_DEFAULT is used.
You may use the COLS_DEFAULT as a base for you own column configuration.
Required is a 3-tuple of (col-name:str,col-type,kwargs:dict) where
 col-name is the desired DB column; this name can be used as kwarg in the log() calls later
 col-type is DBConfig.Integer or DBConfig.String
 kwargs is optional (can be left out) and contains kwargs for the sqlalchemy Column.
Example:
To add an own integer column, take the default columns, and add your
own pair of (column-name,column-type) like that:
cols=DBConfig.COLS_DEFAULT + (("mycolumn",DBConfig.Integer))
To define you column as primary key, use
cols=DBConfig.COLS_DEFAULT + (("mycolumn",DBConfig.Integer,{"primary_key":True}))

Overrides: object.__init__

Class Variable Details [hide private]

COLS_DEFAULT

Value:
(('pid', <class 'sqlalchemy.types.Integer'>),
 ('clientid', <class 'sqlalchemy.types.Integer'>),
 ('msgid', <class 'sqlalchemy.types.Integer'>),
 ('ts',
  String(length=32, convert_unicode=False, assert_unicode=None, unicod\
e_error=None, _warn_on_bytestring=False)),
 ('cat',
  String(length=1, convert_unicode=False, assert_unicode=None, unicode\
...