sqlobject.col module

Col – SQLObject columns

Note that each column object is named BlahBlahCol, and these are used in class definitions. But there’s also a corresponding SOBlahBlahCol object, which is used in SQLObject classes.

An explanation: when a SQLObject subclass is created, the metaclass looks through your class definition for any subclasses of Col. It collects them together, and indexes them to do all the database stuff you like, like the magic attributes and whatnot. It then asks the Col object to create an SOCol object (usually a subclass, actually). The SOCol object contains all the interesting logic, as well as a record of the attribute name you used and the class it is bound to (set by the metaclass).

So, in summary: Col objects are what you define, but SOCol objects are what gets used.

sqlobject.col.use_microseconds(use=True)[source]
class sqlobject.col.UuidCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOUuidCol

class sqlobject.col.SOPickleCol(**kw)[source]

Bases: sqlobject.col.SOBLOBCol

createValidators()[source]
class sqlobject.col.KeyCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOKeyCol

class sqlobject.col.SOForeignKey(**kw)[source]

Bases: sqlobject.col.SOKeyCol

createValidators()[source]
maxdbCreateReferenceConstraint()[source]
maxdbCreateSQL()[source]
mssqlCreateReferenceConstraint()[source]
mssqlCreateSQL(connection=None)[source]
mysqlCreateReferenceConstraint()[source]
mysqlCreateSQL(connection=None)[source]
postgresCreateReferenceConstraint()[source]
postgresCreateSQL()[source]
sqliteCreateSQL()[source]
sybaseCreateReferenceConstraint()[source]
sybaseCreateSQL()[source]
class sqlobject.col.DecimalStringCol(name=None, **kw)[source]

Bases: sqlobject.col.StringCol

baseClass

alias of SODecimalStringCol

class sqlobject.col.TimestampCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOTimestampCol

class sqlobject.col.BigIntCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOBigIntCol

class sqlobject.col.JsonbCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOJsonbCol

class sqlobject.col.SOJsonbCol(name, soClass, creationOrder, dbName=None, default=<class sqlobject.sqlbuilder.NoDefault>, defaultSQL=None, foreignKey=None, alternateID=False, alternateMethodName=None, constraints=None, notNull=<class sqlobject.sqlbuilder.NoDefault>, notNone=<class sqlobject.sqlbuilder.NoDefault>, unique=<class sqlobject.sqlbuilder.NoDefault>, sqlType=None, columnDef=None, validator=None, validator2=None, immutable=False, cascade=None, lazy=False, noCache=False, forceDBName=False, title=None, tags=[], origName=None, dbEncoding=None, extra_vars=None)[source]

Bases: sqlobject.col.SOCol

createValidators()[source]
class sqlobject.col.SOCurrencyCol(**kw)[source]

Bases: sqlobject.col.SODecimalCol

class sqlobject.col.SOTimestampCol(**kw)[source]

Bases: sqlobject.col.SODateTimeCol

Necessary to support MySQL’s use of TIMESTAMP versus DATETIME types

class sqlobject.col.SODecimalStringCol(**kw)[source]

Bases: sqlobject.col.SOStringCol

createValidators()[source]
class sqlobject.col.JSONCol(name=None, **kw)[source]

Bases: sqlobject.col.StringCol

baseClass

alias of SOJSONCol

class sqlobject.col.StringCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOStringCol

class sqlobject.col.SOStringLikeCol(**kw)[source]

Bases: sqlobject.col.SOCol

A common ancestor for SOStringCol and SOUnicodeCol

autoConstraints()[source]
class sqlobject.col.SOIntCol(**kw)[source]

Bases: sqlobject.col.SOCol

addSQLAttrs(str)[source]
autoConstraints()[source]
createValidators()[source]
class sqlobject.col.SOFloatCol(name, soClass, creationOrder, dbName=None, default=<class sqlobject.sqlbuilder.NoDefault>, defaultSQL=None, foreignKey=None, alternateID=False, alternateMethodName=None, constraints=None, notNull=<class sqlobject.sqlbuilder.NoDefault>, notNone=<class sqlobject.sqlbuilder.NoDefault>, unique=<class sqlobject.sqlbuilder.NoDefault>, sqlType=None, columnDef=None, validator=None, validator2=None, immutable=False, cascade=None, lazy=False, noCache=False, forceDBName=False, title=None, tags=[], origName=None, dbEncoding=None, extra_vars=None)[source]

Bases: sqlobject.col.SOCol

autoConstraints()[source]
createValidators()[source]
class sqlobject.col.SODecimalCol(**kw)[source]

Bases: sqlobject.col.SOCol

createValidators()[source]
class sqlobject.col.SOEnumCol(**kw)[source]

Bases: sqlobject.col.SOCol

autoConstraints()[source]
createValidators()[source]
class sqlobject.col.SOUuidCol(name, soClass, creationOrder, dbName=None, default=<class sqlobject.sqlbuilder.NoDefault>, defaultSQL=None, foreignKey=None, alternateID=False, alternateMethodName=None, constraints=None, notNull=<class sqlobject.sqlbuilder.NoDefault>, notNone=<class sqlobject.sqlbuilder.NoDefault>, unique=<class sqlobject.sqlbuilder.NoDefault>, sqlType=None, columnDef=None, validator=None, validator2=None, immutable=False, cascade=None, lazy=False, noCache=False, forceDBName=False, title=None, tags=[], origName=None, dbEncoding=None, extra_vars=None)[source]

Bases: sqlobject.col.SOCol

createValidators()[source]
class sqlobject.col.SOTimedeltaCol(name, soClass, creationOrder, dbName=None, default=<class sqlobject.sqlbuilder.NoDefault>, defaultSQL=None, foreignKey=None, alternateID=False, alternateMethodName=None, constraints=None, notNull=<class sqlobject.sqlbuilder.NoDefault>, notNone=<class sqlobject.sqlbuilder.NoDefault>, unique=<class sqlobject.sqlbuilder.NoDefault>, sqlType=None, columnDef=None, validator=None, validator2=None, immutable=False, cascade=None, lazy=False, noCache=False, forceDBName=False, title=None, tags=[], origName=None, dbEncoding=None, extra_vars=None)[source]

Bases: sqlobject.col.SOCol

createValidators()[source]
class sqlobject.col.SetCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOSetCol

class sqlobject.col.SOUnicodeCol(**kw)[source]

Bases: sqlobject.col.SOStringLikeCol

createValidators()[source]
class sqlobject.col.SOTinyIntCol(**kw)[source]

Bases: sqlobject.col.SOIntCol

class sqlobject.col.BoolCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOBoolCol

class sqlobject.col.TinyIntCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOTinyIntCol

class sqlobject.col.SOCol(name, soClass, creationOrder, dbName=None, default=<class sqlobject.sqlbuilder.NoDefault>, defaultSQL=None, foreignKey=None, alternateID=False, alternateMethodName=None, constraints=None, notNull=<class sqlobject.sqlbuilder.NoDefault>, notNone=<class sqlobject.sqlbuilder.NoDefault>, unique=<class sqlobject.sqlbuilder.NoDefault>, sqlType=None, columnDef=None, validator=None, validator2=None, immutable=False, cascade=None, lazy=False, noCache=False, forceDBName=False, title=None, tags=[], origName=None, dbEncoding=None, extra_vars=None)[source]

Bases: object

autoConstraints()[source]
createSQL()[source]
createValidators()[source]

Create a list of validators for the column.

default
firebirdCreateSQL()[source]
getDbEncoding(state, default='utf-8')[source]
joinName
maxdbCreateSQL()[source]
mssqlCreateSQL(connection=None)[source]
mysqlCreateSQL(connection=None)[source]
postgresCreateSQL()[source]
sqliteCreateSQL()[source]
sybaseCreateSQL()[source]
validator
class sqlobject.col.SODateTimeCol(**kw)[source]

Bases: sqlobject.col.SOCol

createValidators()[source]
datetimeFormat = '%Y-%m-%d %H:%M:%S.%f'
class sqlobject.col.SOBLOBCol(**kw)[source]

Bases: sqlobject.col.SOStringCol

createValidators()[source]
class sqlobject.col.SOKeyCol(**kw)[source]

Bases: sqlobject.col.SOCol

key_type = {<type 'str'>: 'TEXT', <type 'int'>: 'INT'}
class sqlobject.col.TimedeltaCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOTimedeltaCol

class sqlobject.col.SODateCol(**kw)[source]

Bases: sqlobject.col.SOCol

createValidators()[source]

Create a validator for the column.

Can be overriden in descendants.

dateFormat = '%Y-%m-%d'
class sqlobject.col.SOSetCol(**kw)[source]

Bases: sqlobject.col.SOCol

autoConstraints()[source]
createValidators()[source]
class sqlobject.col.CurrencyCol(name=None, **kw)[source]

Bases: sqlobject.col.DecimalCol

baseClass

alias of SOCurrencyCol

class sqlobject.col.SOMediumIntCol(**kw)[source]

Bases: sqlobject.col.SOIntCol

class sqlobject.col.ForeignKey(foreignKey=None, **kw)[source]

Bases: sqlobject.col.KeyCol

baseClass

alias of SOForeignKey

class sqlobject.col.DateCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SODateCol

class sqlobject.col.SOSmallIntCol(**kw)[source]

Bases: sqlobject.col.SOIntCol

class sqlobject.col.PickleCol(name=None, **kw)[source]

Bases: sqlobject.col.BLOBCol

baseClass

alias of SOPickleCol

class sqlobject.col.SOJSONCol(**kw)[source]

Bases: sqlobject.col.SOStringCol

createValidators()[source]
class sqlobject.col.BLOBCol(name=None, **kw)[source]

Bases: sqlobject.col.StringCol

baseClass

alias of SOBLOBCol

class sqlobject.col.IntCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOIntCol

class sqlobject.col.SOBigIntCol(**kw)[source]

Bases: sqlobject.col.SOIntCol

class sqlobject.col.SOStringCol(**kw)[source]

Bases: sqlobject.col.SOStringLikeCol

createValidators(dataType=None)[source]
class sqlobject.col.Col(name=None, **kw)[source]

Bases: object

baseClass

alias of SOCol

name
withClass(soClass)[source]
class sqlobject.col.EnumCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOEnumCol

class sqlobject.col.SOTimeCol(**kw)[source]

Bases: sqlobject.col.SOCol

createValidators()[source]
timeFormat = '%H:%M:%S.%f'
class sqlobject.col.SOBoolCol(name, soClass, creationOrder, dbName=None, default=<class sqlobject.sqlbuilder.NoDefault>, defaultSQL=None, foreignKey=None, alternateID=False, alternateMethodName=None, constraints=None, notNull=<class sqlobject.sqlbuilder.NoDefault>, notNone=<class sqlobject.sqlbuilder.NoDefault>, unique=<class sqlobject.sqlbuilder.NoDefault>, sqlType=None, columnDef=None, validator=None, validator2=None, immutable=False, cascade=None, lazy=False, noCache=False, forceDBName=False, title=None, tags=[], origName=None, dbEncoding=None, extra_vars=None)[source]

Bases: sqlobject.col.SOCol

autoConstraints()[source]
createValidators()[source]
class sqlobject.col.DecimalCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SODecimalCol

class sqlobject.col.TimeCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOTimeCol

class sqlobject.col.MediumIntCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOMediumIntCol

class sqlobject.col.DateTimeCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SODateTimeCol

static now()[source]
class sqlobject.col.FloatCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOFloatCol

class sqlobject.col.UnicodeCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOUnicodeCol

class sqlobject.col.SmallIntCol(name=None, **kw)[source]

Bases: sqlobject.col.Col

baseClass

alias of SOSmallIntCol