SQLAlchemy column types

class coaster.sqlalchemy.columns.JsonDict(*args, **kwargs)[source]

Represents a JSON data structure. Usage:

column = Column(JsonDict)

The column will be represented to the database as a JSONB column if the server is PostgreSQL 9.4 or later, JSON if PostgreSQL 9.2 or 9.3, and TEXT for everything else. The column behaves like a JSON store regardless of the backing data type.

impl

alias of TEXT

class coaster.sqlalchemy.columns.MarkdownComposite(text, html=None)[source]

Represents GitHub-flavoured Markdown text and rendered HTML as a composite column.

coaster.sqlalchemy.columns.MarkdownColumn(name, deferred=False, group=None, **kwargs)[source]

Create a composite column that autogenerates HTML from Markdown text, storing data in db columns named with _html and _text prefixes.

class coaster.sqlalchemy.columns.UUIDType(binary=True, native=True)[source]

Stores a UUID in the database natively when it can and falls back to a BINARY(16) or a CHAR(32) when it can’t.

from sqlalchemy_utils import UUIDType
import uuid

class User(Base):
    __tablename__ = 'user'

    # Pass `binary=False` to fallback to CHAR instead of BINARY
    id = sa.Column(UUIDType(binary=False), primary_key=True)
python_type

alias of UUID