Plugin

class geoalchemy2.admin.plugin.GeoEngine(url, kwargs)[source]

Bases: CreateEnginePlugin

A plugin to create sqlalchemy.Engine objects with specific events to handle spatial data.

This plugin should only be used with the sqlalchemy.create_engine() function. This plugin will automatically attach the relevant event listeners to the new engine depending on its dialect. For some specific dialects it’s even possible to pass arguments to customize the functions called by the listeners. These arguments have the following form: geoalchemy2_<event>_<dialect>_<argument_name>. For example, creating a new SQLite DB and initialize the SpatiaLite extension with only the WGS84 SRID can be performed this way:

db_url = "sqlite:////tmp/test_db.sqlite?geoalchemy2_connect_sqlite_init_mode=WGS84"
engine = sqlalchemy.create_engine(db_url, plugins=["geoalchemy2"])

The names of the parameters can be found in the event listener of each dialect. Note that all dialects don’t have listeners for all events.

engine_created(engine)[source]

Attach event listeners after the new Engine object is created.

static str_to_bool(argument)[source]

Cast argument to bool.

update_url(url)[source]

Update the URL to one that no longer includes specific parameters.