title: NameError: global name 'create_engine' is not defined [when trying to create a SQLAlchemyJobStore]
body: <p>I am trying to add a <code>SQLAlchemyJobStore</code> job store (and make it the <code>default</code> job store) and store some jobs on it. I am running <code>mysql</code> which has a database named <code>jobstore</code>.</p>
  
  <p>I have the following program which tries to open a <code>SQLAlchemyJobStore</code> job store to the <code>mysql</code> db that is running:</p>
  
  <pre><code># sqlalchemy.py 
  from sqlalchemy import *
  from apscheduler.jobstores.sqlalchemy_store import SQLAlchemyJobStore
  from apscheduler.scheduler import Scheduler
  from datetime import datetime, timedelta
  import time
  
  def alarm(time):
      print('Alarm! This alarm was scheduled at %s.' % time)
  
  _aps_config = {'standalone': 'True'}
  _dbURL = 'mysql://root:&lt;root-password&gt;@localhost/jobstore'
  
  if __name__ == '__main__':
  
      scheduler = Scheduler(_aps_config)
      scheduler.add_jobstore(SQLAlchemyJobStore(url=_dbURL), 'default')
  
      alarm_time = datetime.now() + timedelta(seconds=10)
      scheduler.add_date_job(alarm, alarm_time, name='alarm1', args=[datetime.now()])
      print 'alarms added: ', alarm_time
  
      alarm_time = datetime.now() + timedelta(seconds=15)
      scheduler.add_date_job(alarm, alarm_time, name='alarm2', args=[datetime.now()])
      print 'alarms added: ', alarm_time
  
      alarm_time = datetime.now() + timedelta(seconds=20)
      scheduler.add_date_job(alarm, alarm_time, name='alarm3', args=[datetime.now()])
      print 'alarms added: ', alarm_time
  
      try:
          scheduler.start()
      except (KeyboardInterrupt, SystemExit):
          scheduler.shutdown()
          pass
  </code></pre>
  
  <p>When trying to run the above code I see the following:</p>
  
  <pre><code>NameError: global name 'create_engine' is not defined
  
  $ python sqlalchemy.py
  Traceback (most recent call last):
    File "sqlalchemy.py", line 19, in &lt;module&gt;
      scheduler.add_jobstore(SQLAlchemyJobStore(url=_dbURL), 'default')
    File "/usr/lib/python2.7/site-packages/APScheduler-2.1.0-py2.7.egg/apscheduler/jobstores/sqlalchemy_store.py", line 29, in __init__
      self.engine = create_engine(url)
  NameError: global name 'create_engine' is not defined
  $ 
  </code></pre>
  
  <p>I see <code>"/usr/lib/python2.7/site-packages/APScheduler-2.1.0-py2.7.egg/apscheduler/jobstores/sqlalchemy_store.py"</code>, the <code>__init__</code> is trying to <code>create_engine</code> and its failing.</p>
  
  <pre><code> 20 class SQLAlchemyJobStore(JobStore):
   21     def __init__(self, url=None, engine=None, tablename='apscheduler_jobs',
   22                  metadata=None, pickle_protocol=pickle.HIGHEST_PROTOCOL):
   23         self.jobs = []
   24         self.pickle_protocol = pickle_protocol
   25 
   26         if engine:
   27             self.engine = engine
   28         elif url:
   29             self.engine = create_engine(url)
  </code></pre>
  
  <p>What is going wrong here?! In other words, how do I create a <code>SQLAlchemyJobStore</code> using <code>APScheduler</code> and successfully store the jobs on them? Any example/code-snippet would be a great help!</p>