Hi List,

How should I set the the future argument to True in the call to create_engine()?

>From https://docs.sqlalchemy.org/en/14/tutorial/engine.html 
><https://docs.sqlalchemy.org/en/14/tutorial/engine.html>:
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

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/48FCE954-14C5-4695-92EC-9CB8582ED990%40gmail.com.

Reply via email to