# 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.

class sqlobject.col.BLOBCol(name=None, **kw)

  Bases: `StringCol`

  baseClass

    alias of `SOBLOBCol`

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

  Bases: `Col`

  baseClass

    alias of `SOBigIntCol`

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

  Bases: `Col`

  baseClass

    alias of `SOBoolCol`

class sqlobject.col.Col(name=None, **kw)

  Bases: `object`

  baseClass

    alias of `SOCol`

  property name
  withClass(soClass)

class sqlobject.col.CurrencyCol(name=None, **kw)

  Bases: `DecimalCol`

  baseClass

    alias of `SOCurrencyCol`

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

  Bases: `Col`

  baseClass

    alias of `SODateCol`

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

  Bases: `Col`

  baseClass

    alias of `SODateTimeCol`

  static now()

class sqlobject.col.DecimalCol(name=None, **kw)

  Bases: `Col`

  baseClass

    alias of `SODecimalCol`

class sqlobject.col.DecimalStringCol(name=None, **kw)

  Bases: `StringCol`

  baseClass

    alias of `SODecimalStringCol`

class sqlobject.col.EnumCol(name=None, **kw)

  Bases: `Col`

  baseClass

    alias of `SOEnumCol`

class sqlobject.col.FloatCol(name=None, **kw)

  Bases: `Col`

  baseClass

    alias of `SOFloatCol`

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

  Bases: `KeyCol`

  baseClass

    alias of `SOForeignKey`

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

  Bases: `Col`

  baseClass

    alias of `SOIntCol`

class sqlobject.col.JSONCol(name=None, **kw)

  Bases: `StringCol`

  baseClass

    alias of `SOJSONCol`

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

  Bases: `Col`

  baseClass

    alias of `SOJsonbCol`

class sqlobject.col.KeyCol(name=None, **kw)

  Bases: `Col`

  baseClass

    alias of `SOKeyCol`

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

  Bases: `Col`

  baseClass

    alias of `SOMediumIntCol`

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

  Bases: `BLOBCol`

  baseClass

    alias of `SOPickleCol`

class sqlobject.col.SOBLOBCol(**kw)

  Bases: `SOStringCol`

  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SOBigIntCol(**kw)

  Bases: `SOIntCol`

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)

  Bases: `SOCol`

  autoConstraints()
  createValidators()

    Create a list of validators for the column.

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)

  Bases: `object`

  autoConstraints()
  createSQL()
  createValidators()

    Create a list of validators for the column.

  property default
  firebirdCreateSQL()
  getDbEncoding(state, default='utf-8')
  property joinName
  maxdbCreateSQL()
  mssqlCreateSQL(connection=None)
  mysqlCreateSQL(connection=None)
  postgresCreateSQL()
  sqliteCreateSQL()
  sybaseCreateSQL()
  property validator

class sqlobject.col.SOCurrencyCol(**kw)

  Bases: `SODecimalCol`

class sqlobject.col.SODateCol(**kw)

  Bases: `SOCol`

  createValidators()

    Create a validator for the column.

    Can be overriden in descendants.

  dateFormat = '%Y-%m-%d'

class sqlobject.col.SODateTimeCol(**kw)

  Bases: `SOCol`

  createValidators()

    Create a list of validators for the column.

  datetimeFormat = '%Y-%m-%d %H:%M:%S.%f'

class sqlobject.col.SODecimalCol(**kw)

  Bases: `SOCol`

  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SODecimalStringCol(**kw)

  Bases: `SOStringCol`

  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SOEnumCol(**kw)

  Bases: `SOCol`

  autoConstraints()
  createValidators()

    Create a list of validators for the column.

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)

  Bases: `SOCol`

  autoConstraints()
  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SOForeignKey(**kw)

  Bases: `SOKeyCol`

  createValidators()

    Create a list of validators for the column.

  maxdbCreateReferenceConstraint()
  maxdbCreateSQL()
  mssqlCreateReferenceConstraint()
  mssqlCreateSQL(connection=None)
  mysqlCreateReferenceConstraint()
  mysqlCreateSQL(connection=None)
  postgresCreateReferenceConstraint()
  postgresCreateSQL()
  sqliteCreateSQL()
  sybaseCreateReferenceConstraint()
  sybaseCreateSQL()

class sqlobject.col.SOIntCol(**kw)

  Bases: `SOCol`

  addSQLAttrs(str)
  autoConstraints()
  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SOJSONCol(**kw)

  Bases: `SOStringCol`

  createValidators()

    Create a list of validators for the column.

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)

  Bases: `SOCol`

  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SOKeyCol(**kw)

  Bases: `SOCol`

  key_type = {<class 'int'>: 'INT', <class 'str'>: 'TEXT'}

class sqlobject.col.SOMediumIntCol(**kw)

  Bases: `SOIntCol`

class sqlobject.col.SOPickleCol(**kw)

  Bases: `SOBLOBCol`

  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SOSetCol(**kw)

  Bases: `SOCol`

  autoConstraints()
  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SOSmallIntCol(**kw)

  Bases: `SOIntCol`

class sqlobject.col.SOStringCol(**kw)

  Bases: `SOStringLikeCol`

  createValidators(dataType=None)

    Create a list of validators for the column.

class sqlobject.col.SOStringLikeCol(**kw)

  Bases: `SOCol`

  A common ancestor for SOStringCol and SOUnicodeCol

  autoConstraints()

class sqlobject.col.SOTimeCol(**kw)

  Bases: `SOCol`

  createValidators()

    Create a list of validators for the column.

  timeFormat = '%H:%M:%S.%f'

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)

  Bases: `SOCol`

  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SOTimestampCol(**kw)

  Bases: `SODateTimeCol`

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

class sqlobject.col.SOTinyIntCol(**kw)

  Bases: `SOIntCol`

class sqlobject.col.SOUnicodeCol(**kw)

  Bases: `SOStringLikeCol`

  createValidators()

    Create a list of validators for the column.

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)

  Bases: `SOCol`

  createValidators()

    Create a list of validators for the column.

class sqlobject.col.SetCol(name=None, **kw)

  Bases: `Col`

  baseClass

    alias of `SOSetCol`

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

  Bases: `Col`

  baseClass

    alias of `SOSmallIntCol`

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

  Bases: `Col`

  baseClass

    alias of `SOStringCol`

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

  Bases: `Col`

  baseClass

    alias of `SOTimeCol`

class sqlobject.col.TimedeltaCol(name=None, **kw)

  Bases: `Col`

  baseClass

    alias of `SOTimedeltaCol`

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

  Bases: `Col`

  baseClass

    alias of `SOTimestampCol`

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

  Bases: `Col`

  baseClass

    alias of `SOTinyIntCol`

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

  Bases: `Col`

  baseClass

    alias of `SOUnicodeCol`

class sqlobject.col.UuidCol(name=None, **kw)

  Bases: `Col`

  baseClass

    alias of `SOUuidCol`

sqlobject.col.use_microseconds(use=True)