This document describes the current stable version of Kombu (5.3). For development docs, go here.

SQLAlchemy Transport Model - kombu.transport.sqlalchemy

SQLAlchemy Transport module for kombu.

Kombu transport using SQL Database as the message store.

Features

  • Type: Virtual

  • Supports Direct: yes

  • Supports Topic: yes

  • Supports Fanout: no

  • Supports Priority: no

  • Supports TTL: no

Connection String

sqla+SQL_ALCHEMY_CONNECTION_STRING
sqlalchemy+SQL_ALCHEMY_CONNECTION_STRING

For details about SQL_ALCHEMY_CONNECTION_STRING see SQLAlchemy Engine Configuration documentation.

Examples

# PostgreSQL with default driver
sqla+postgresql://scott:tiger@localhost/mydatabase

# PostgreSQL with psycopg2 driver
sqla+postgresql+psycopg2://scott:tiger@localhost/mydatabase

# PostgreSQL with pg8000 driver
sqla+postgresql+pg8000://scott:tiger@localhost/mydatabase

# MySQL with default driver
sqla+mysql://scott:tiger@localhost/foo

# MySQL with mysqlclient driver (a maintained fork of MySQL-Python)
sqla+mysql+mysqldb://scott:tiger@localhost/foo

# MySQL with PyMySQL driver
sqla+mysql+pymysql://scott:tiger@localhost/foo

Transport Options

  • queue_tablename: Name of table storing queues.

  • message_tablename: Name of table storing messages.

Moreover parameters of sqlalchemy.create_engine() function can be passed as transport options.

Transport

class kombu.transport.sqlalchemy.Transport(client, **kwargs)[source]

The transport class.

class Channel(connection, **kwargs)

The channel class.

property message_cls
property queue_cls
property session
can_parse_url = True

Set to True if Connection should pass the URL unmodified.

connection_errors = (<class 'sqlalchemy.exc.OperationalError'>,)

Tuple of errors that can happen due to connection failure.

default_port = 0

port number used when no port is specified.

driver_name = 'sqlalchemy'

Name of driver library (e.g. ‘py-amqp’, ‘redis’).

driver_type = 'sql'

Type of driver, can be used to separate transports using the AMQP protocol (driver_type: ‘amqp’), Redis (driver_type: ‘redis’), etc…

driver_version()[source]

Channel

class kombu.transport.sqlalchemy.Channel(connection, **kwargs)[source]

The channel class.

property message_cls
property queue_cls
property session

SQLAlchemy Transport Model - kombu.transport.sqlalchemy.models

Kombu transport using SQLAlchemy as the message store.

Models

class kombu.transport.sqlalchemy.models.Queue(name)[source]

The queue class.

id = Column(None, Integer(), table=None, primary_key=True, nullable=False, default=Sequence('queue_id_sequence'))
name = Column(None, String(length=200), table=None)
class kombu.transport.sqlalchemy.models.Message(payload, queue)[source]

The message class.

id = Column(None, Integer(), table=None, primary_key=True, nullable=False, default=Sequence('message_id_sequence'))
visible = Column(None, Boolean(), table=None, default=ScalarElementColumnDefault(True))
sent_at = Column('timestamp', DateTime(), table=None, onupdate=CallableColumnDefault(<function datetime.now>))
payload = Column(None, Text(), table=None, nullable=False)
version = Column(None, SmallInteger(), table=None, nullable=False, default=ScalarElementColumnDefault(1))