# SQLAlchemy 0.7 Documentation

Search:
Release: 0.7.10 | Release Date: February 7, 2013

# Drizzle

Support for the Drizzle database.

Drizzle is a variant of MySQL. Unlike MySQL, Drizzle’s default storage engine is InnoDB (transactions, foreign-keys) rather than MyISAM. For more Notable Differences, visit the Drizzle Documentation.

The SQLAlchemy Drizzle dialect leans heavily on the MySQL dialect, so much of the SQLAlchemy MySQL documentation is also relevant.

## Connecting

See the individual driver sections below for details on connecting.

## Drizzle Data Types

As with all SQLAlchemy dialects, all UPPERCASE types that are known to be valid with Drizzle are importable from the top level dialect:

    from sqlalchemy.dialects.drizzle import \
            BIGINT, BINARY, BLOB, BOOLEAN, CHAR, DATE, DATETIME,
            DECIMAL, DOUBLE, ENUM, FLOAT, INT, INTEGER,
            NUMERIC, TEXT, TIME, TIMESTAMP, VARBINARY, VARCHAR

Types which are specific to Drizzle, or have Drizzle-specific construction arguments, are as follows:

class `sqlalchemy.dialects.drizzle.``BIGINT`(**kw)

  Bases: `sqlalchemy.types.BIGINT`

  Drizzle BIGINTEGER type.

  `__init__`(**kw)

    Construct a BIGINTEGER.

class `sqlalchemy.dialects.drizzle.``CHAR`(length=None, **kwargs)

  Bases: `sqlalchemy.dialects.drizzle.base._StringType`, `sqlalchemy.types.CHAR`

  Drizzle CHAR type, for fixed-length character data.

  `__init__`(length=None, **kwargs)

    Construct a CHAR.

    Parameters: | length – Maximum data length, in characters. binary – Optional, use the default binary collation for the national character set. This does not affect the type of data stored, use a BINARY type for binary data. collation – Optional, request a particular collation. Must be compatible with the national character set.

class `sqlalchemy.dialects.drizzle.``DECIMAL`(precision=None, scale=None, asdecimal=True, **kw)

  Bases: `sqlalchemy.dialects.drizzle.base._NumericType`, `sqlalchemy.types.DECIMAL`

  Drizzle DECIMAL type.

  `__init__`(precision=None, scale=None, asdecimal=True, **kw)

    Construct a DECIMAL.

    Parameters: | precision – Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. scale – The number of digits after the decimal point.

class `sqlalchemy.dialects.drizzle.``DOUBLE`(precision=None, scale=None, asdecimal=True, **kw)

  Bases: `sqlalchemy.dialects.drizzle.base._FloatType`

  Drizzle DOUBLE type.

  `__init__`(precision=None, scale=None, asdecimal=True, **kw)

    Construct a DOUBLE.

    Parameters: | precision – Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. scale – The number of digits after the decimal point.

class `sqlalchemy.dialects.drizzle.``ENUM`(*enums, **kw)

  Bases: `sqlalchemy.dialects.mysql.base.ENUM`

  Drizzle ENUM type.

  `__init__`(*enums, **kw)

    Construct an ENUM.

    Example:

    > Column(‘myenum’, ENUM(“foo”, “bar”, “baz”))

    Parameters: | enums – The range of valid values for this ENUM. Values will be quoted when generating the schema according to the quoting flag (see below). strict – Defaults to False: ensure that a given value is in this ENUM’s range of permissible values when inserting or updating rows. Note that Drizzle will not raise a fatal error if you attempt to store an out of range value- an alternate value will be stored instead. (See Drizzle ENUM documentation.) collation – Optional, a column-level collation for this string value. Takes precedence to ‘binary’ short-hand. binary – Defaults to False: short-hand, pick the binary collation type that matches the column’s character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. quoting – Defaults to ‘auto’: automatically determine enum value quoting. If all enum values are surrounded by the same quoting character, then use ‘quoted’ mode. Otherwise, use ‘unquoted’ mode. ‘quoted’: values in enums are already quoted, they will be used directly when generating the schema - this usage is deprecated. ‘unquoted’: values in enums are not quoted, they will be escaped and surrounded by single quotes when generating the schema. Previous versions of this type always required manually quoted values to be supplied; future versions will always quote the string literals for you. This is a transitional option.

class `sqlalchemy.dialects.drizzle.``FLOAT`(precision=None, scale=None, asdecimal=False, **kw)

  Bases: `sqlalchemy.dialects.drizzle.base._FloatType`, `sqlalchemy.types.FLOAT`

  Drizzle FLOAT type.

  `__init__`(precision=None, scale=None, asdecimal=False, **kw)

    Construct a FLOAT.

    Parameters: | precision – Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. scale – The number of digits after the decimal point.

class `sqlalchemy.dialects.drizzle.``INTEGER`(**kw)

  Bases: `sqlalchemy.types.INTEGER`

  Drizzle INTEGER type.

  `__init__`(**kw)

    Construct an INTEGER.

class `sqlalchemy.dialects.drizzle.``NUMERIC`(precision=None, scale=None, asdecimal=True, **kw)

  Bases: `sqlalchemy.dialects.drizzle.base._NumericType`, `sqlalchemy.types.NUMERIC`

  Drizzle NUMERIC type.

  `__init__`(precision=None, scale=None, asdecimal=True, **kw)

    Construct a NUMERIC.

    Parameters: | precision – Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. scale – The number of digits after the decimal point.

class `sqlalchemy.dialects.drizzle.``REAL`(precision=None, scale=None, asdecimal=True, **kw)

  Bases: `sqlalchemy.dialects.drizzle.base._FloatType`, `sqlalchemy.types.REAL`

  Drizzle REAL type.

  `__init__`(precision=None, scale=None, asdecimal=True, **kw)

    Construct a REAL.

    Parameters: | precision – Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. scale – The number of digits after the decimal point.

class `sqlalchemy.dialects.drizzle.``TEXT`(length=None, **kw)

  Bases: `sqlalchemy.dialects.drizzle.base._StringType`, `sqlalchemy.types.TEXT`

  Drizzle TEXT type, for text up to 2^16 characters.

  `__init__`(length=None, **kw)

    Construct a TEXT.

    Parameters: | length – Optional, if provided the server may optimize storage by substituting the smallest TEXT type sufficient to store `length` characters. collation – Optional, a column-level collation for this string value. Takes precedence to ‘binary’ short-hand. binary – Defaults to False: short-hand, pick the binary collation type that matches the column’s character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data.

class `sqlalchemy.dialects.drizzle.``TIMESTAMP`(timezone=False)

  Bases: `sqlalchemy.types.TIMESTAMP`

  Drizzle TIMESTAMP type.

  `__init__`(timezone=False)

    Construct a new `DateTime`.

    Parameters: | timezone – boolean. If True, and supported by the

    backend, will produce ‘TIMESTAMP WITH TIMEZONE’. For backends that don’t support timezone aware timestamps, has no effect.

class `sqlalchemy.dialects.drizzle.``VARCHAR`(length=None, **kwargs)

  Bases: `sqlalchemy.dialects.drizzle.base._StringType`, `sqlalchemy.types.VARCHAR`

  Drizzle VARCHAR type, for variable-length character data.

  `__init__`(length=None, **kwargs)

    Construct a VARCHAR.

    Parameters: | collation – Optional, a column-level collation for this string value. Takes precedence to ‘binary’ short-hand. binary – Defaults to False: short-hand, pick the binary collation type that matches the column’s character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data.

## MySQL-Python Notes

Support for the Drizzle database via the mysql-python adapter.

MySQL-Python is available at:

> http://sourceforge.net/projects/mysql-python

### Connecting

Connect string format:

    drizzle+mysqldb://<user>:<password>@<host>[:<port>]/<dbname>