sqlobject.col module — SQLObject 3.9.1 documentation

# 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: `sqlobject.col.StringCol`

  `baseClass`

    alias of `sqlobject.col.SOBLOBCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOBigIntCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOBoolCol`

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

  Bases: `object`

  `baseClass`

    alias of `sqlobject.col.SOCol`

  property `name`
  `withClass`(soClass)

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

  Bases: `sqlobject.col.DecimalCol`

  `baseClass`

    alias of `sqlobject.col.SOCurrencyCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SODateCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SODateTimeCol`

  static `now`()

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SODecimalCol`

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

  Bases: `sqlobject.col.StringCol`

  `baseClass`

    alias of `sqlobject.col.SODecimalStringCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOEnumCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOFloatCol`

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

  Bases: `sqlobject.col.KeyCol`

  `baseClass`

    alias of `sqlobject.col.SOForeignKey`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOIntCol`

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

  Bases: `sqlobject.col.StringCol`

  `baseClass`

    alias of `sqlobject.col.SOJSONCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOJsonbCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOKeyCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOMediumIntCol`

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

  Bases: `sqlobject.col.BLOBCol`

  `baseClass`

    alias of `sqlobject.col.SOPickleCol`

class `sqlobject.col.` `SOBLOBCol`(**kw)

  Bases: `sqlobject.col.SOStringCol`

  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SOBigIntCol`(**kw)

  Bases: `sqlobject.col.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: `sqlobject.col.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: `sqlobject.col.SODecimalCol`

class `sqlobject.col.` `SODateCol`(**kw)

  Bases: `sqlobject.col.SOCol`

  `createValidators`()

    Create a validator for the column.

    Can be overriden in descendants.

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

class `sqlobject.col.` `SODateTimeCol`(**kw)

  Bases: `sqlobject.col.SOCol`

  `createValidators`()

    Create a list of validators for the column.

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

class `sqlobject.col.` `SODecimalCol`(**kw)

  Bases: `sqlobject.col.SOCol`

  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SODecimalStringCol`(**kw)

  Bases: `sqlobject.col.SOStringCol`

  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SOEnumCol`(**kw)

  Bases: `sqlobject.col.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: `sqlobject.col.SOCol`

  `autoConstraints`()
  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SOForeignKey`(**kw)

  Bases: `sqlobject.col.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: `sqlobject.col.SOCol`

  `addSQLAttrs`(str)
  `autoConstraints`()
  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SOJSONCol`(**kw)

  Bases: `sqlobject.col.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: `sqlobject.col.SOCol`

  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SOKeyCol`(**kw)

  Bases: `sqlobject.col.SOCol`

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

class `sqlobject.col.` `SOMediumIntCol`(**kw)

  Bases: `sqlobject.col.SOIntCol`

class `sqlobject.col.` `SOPickleCol`(**kw)

  Bases: `sqlobject.col.SOBLOBCol`

  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SOSetCol`(**kw)

  Bases: `sqlobject.col.SOCol`

  `autoConstraints`()
  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SOSmallIntCol`(**kw)

  Bases: `sqlobject.col.SOIntCol`

class `sqlobject.col.` `SOStringCol`(**kw)

  Bases: `sqlobject.col.SOStringLikeCol`

  `createValidators`(dataType=None)

    Create a list of validators for the column.

class `sqlobject.col.` `SOStringLikeCol`(**kw)

  Bases: `sqlobject.col.SOCol`

  A common ancestor for SOStringCol and SOUnicodeCol

  `autoConstraints`()

class `sqlobject.col.` `SOTimeCol`(**kw)

  Bases: `sqlobject.col.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: `sqlobject.col.SOCol`

  `createValidators`()

    Create a list of validators for the column.

class `sqlobject.col.` `SOTimestampCol`(**kw)

  Bases: `sqlobject.col.SODateTimeCol`

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

class `sqlobject.col.` `SOTinyIntCol`(**kw)

  Bases: `sqlobject.col.SOIntCol`

class `sqlobject.col.` `SOUnicodeCol`(**kw)

  Bases: `sqlobject.col.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: `sqlobject.col.SOCol`

  `createValidators`()

    Create a list of validators for the column.

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOSetCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOSmallIntCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOStringCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOTimeCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOTimedeltaCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOTimestampCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOTinyIntCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOUnicodeCol`

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

  Bases: `sqlobject.col.Col`

  `baseClass`

    alias of `sqlobject.col.SOUuidCol`

`sqlobject.col.` `use_microseconds`(use=True)