sabridge API

class sabridge.Bridge
__getitem__(model_cls)

Returns the sqlalchemy.schema.Table representation of model_cls, a django.db.models.Model subclass.

Use dict-notation to obtain the Table:

>>> from myapp.models import mymodel
>>> brige = Bridge()
>>> mytable = bridge[mymodel]
>>> print type(mytable)
<class 'sqlalchemy.schema.Table'>

Bridge stores the Table for the lifetime of the Bridge, thus table reflection only occurs once per model for the Bridge.

connection_url()

Build a URL for sqlalchemy.create_engine() based upon the database defined by django.db.connection

meta

sqlalchemy.schema.MetaData instance bound to the current Django database connection.