Hi List,
How should I set the the future argument to True in the call to create_engine()?
The Engine is created by using create_engine(), specifying the create_engine.future flag set to True so that we make full use of 2.0 style usage:
>>> from sqlalchemy import create_engine
>>> engine = create_engine("
sqlite+pysqlite:///:memory:", echo=True, future=True)
What I’ve tried that doesn’t appear to be working is adding it to settings in myproject/__init__.py:main():
def main(global_config, **settings):
"""Return a Pyramid WSGI application."""
settings['sqlalchemy.future'] = True
...
Later, after starting Pyramid, I see it passed to create_engine() in my debugger.
In sqlalchemy.engine.create.py:engine_from_config():
options is: {'future': True, '_coerce_config': True}
And then:
return create_engine(url, **options)
However, if I look at its value in a class’ view, I see future is False, i.e.:
def __init__(self, request):
self.request = request
@view_config(route_name=’test', renderer=‘/test.mako')
def test(self):
# From here, self.request.dbsession.future is False.
…
I presume it should be True at this point.
Has anyone seen this or set this flag and used it successfully?
Thanks