summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2017-11-07 01:53:09 +0200
committerAlex Grönholm <alex.gronholm@nextday.fi>2017-11-07 01:54:57 +0200
commit51f76aec1495a31dc0037f9b13d2cd569ad5a861 (patch)
tree86fa7673cbecc9729d333bf999b3714453feaa8c
parent64482a782cb8c32f6658a8bd93ece90b55cf05e2 (diff)
downloadapscheduler-51f76aec1495a31dc0037f9b13d2cd569ad5a861.tar.gz
Added the engine_options option to SQLAlchemyJobStore
Fixes #228.
-rw-r--r--apscheduler/jobstores/sqlalchemy.py17
-rw-r--r--docs/conf.py3
-rw-r--r--docs/versionhistory.rst6
3 files changed, 18 insertions, 8 deletions
diff --git a/apscheduler/jobstores/sqlalchemy.py b/apscheduler/jobstores/sqlalchemy.py
index 45c2501..af0c96b 100644
--- a/apscheduler/jobstores/sqlalchemy.py
+++ b/apscheduler/jobstores/sqlalchemy.py
@@ -25,20 +25,23 @@ class SQLAlchemyJobStore(BaseJobStore):
Plugin alias: ``sqlalchemy``
- :param str url: connection string (see `SQLAlchemy documentation
- <http://docs.sqlalchemy.org/en/latest/core/engines.html?highlight=create_engine#database-urls>`_
- on this)
- :param engine: an SQLAlchemy Engine to use instead of creating a new one based on ``url``
+ :param str url: connection string (see
+ :ref:`SQLAlchemy documentation <sqlalchemy:database_urls>` on this)
+ :param engine: an SQLAlchemy :class:`~sqlalchemy.engine.Engine` to use instead of creating a
+ new one based on ``url``
:param str tablename: name of the table to store jobs in
- :param metadata: a :class:`~sqlalchemy.MetaData` instance to use instead of creating a new one
+ :param metadata: a :class:`~sqlalchemy.schema.MetaData` instance to use instead of creating a
+ new one
:param int pickle_protocol: pickle protocol level to use (for serialization), defaults to the
highest available
:param str tableschema: name of the (existing) schema in the target database where the table
should be
+ :param dict engine_options: keyword arguments to :func:`~sqlalchemy.create_engine`
+ (ignored if ``engine`` is given)
"""
def __init__(self, url=None, engine=None, tablename='apscheduler_jobs', metadata=None,
- pickle_protocol=pickle.HIGHEST_PROTOCOL, tableschema=None):
+ pickle_protocol=pickle.HIGHEST_PROTOCOL, tableschema=None, engine_options=None):
super(SQLAlchemyJobStore, self).__init__()
self.pickle_protocol = pickle_protocol
metadata = maybe_ref(metadata) or MetaData()
@@ -46,7 +49,7 @@ class SQLAlchemyJobStore(BaseJobStore):
if engine:
self.engine = maybe_ref(engine)
elif url:
- self.engine = create_engine(url)
+ self.engine = create_engine(url, **(engine_options or {}))
else:
raise ValueError('Need either "engine" or "url" defined')
diff --git a/docs/conf.py b/docs/conf.py
index 86bf455..1aefd3d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -194,4 +194,5 @@ latex_documents = [
# If false, no module index is generated.
#latex_use_modindex = True
-intersphinx_mapping = {'python': ('http://docs.python.org/', None)}
+intersphinx_mapping = {'python': ('http://docs.python.org/', None),
+ 'sqlalchemy': ('http://docs.sqlalchemy.org/en/latest/', None)}
diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst
index 9edcfac..66c09d3 100644
--- a/docs/versionhistory.rst
+++ b/docs/versionhistory.rst
@@ -4,6 +4,12 @@ Version history
To find out how to migrate your application from a previous version of
APScheduler, see the :doc:`migration section <migration>`.
+3.5.0
+-----
+
+* Added the ``engine_options`` option to ``SQLAlchemyJobStore``
+
+
3.4.0
-----