Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.
This repository was archived by the owner on May 7, 2024. It is now read-only.

flask_sqlalchemy_session not working in Query.with_session() context #8

Open
@mzoll

Description

@mzoll

First of all, thanks for this nice wrapper. It really works like a charm.

However, I have a problem to get it going with session-less queries, like so

class MyORM(Base):
    __table__ = 'mytable'
    id = Column('Integer')
    name = Column('String')

from flask_sqlalchemy_session import current_session

@app.route("/home_alone")
def home_alone():
    bare_qry = Query(MyORM)
    rslt = bare_qry.with_session(current_session).all()

I will get the AttributeError: 'flask_scoped_session' object has no attribute '_autoflush'

I guess the problem is that your wrapper around the session does not let 'shine through' certain trickery of the native sqlaclhemy.Session.

I am using flask_sqlalchemy_session version 1.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions