Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session's merge method get error #100

Open
tonyshare opened this issue Aug 5, 2024 · 0 comments
Open

session's merge method get error #100

tonyshare opened this issue Aug 5, 2024 · 0 comments

Comments

@tonyshare
Copy link

tornado version latest
sqlalchemy version latest
tornado-sqlalchemy lastest

        with self.make_session() as session:
               try:
                    yield as_future(
                        session.merge(
                            Learner(
                                id=learner_id,
                            )
                        )
                    )

                    yield session.commit()
                except SQLAlchemyError as e:
                    yield as_future(session.rollback())

got error

Traceback (most recent call last):
  File "/srv/.venv/platform/lib/python3.10/site-packages/tornado/web.py", line 1790, in _execute
    result = await result
  File "/srv/.venv/platform/lib/python3.10/site-packages/tornado/gen.py", line 779, in run
    yielded = self.gen.throw(exc)
  File "/srv/web/api/manager/uplaod.py", line 117, in post
    yield as_future(session.merge(
  File "/srv/.venv/platform/lib/python3.10/site-packages/tornado/gen.py", line 766, in run
    value = future.result()
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
TypeError: 'Learner' object is not callable

is tornado-sqlalchemy only suport query method, or my code is miss use the as_future method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant