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

get_bind() got an unexpected keyword argument 'bind' #971

Closed
flyher opened this issue May 14, 2021 · 2 comments
Closed

get_bind() got an unexpected keyword argument 'bind' #971

flyher opened this issue May 14, 2021 · 2 comments

Comments

@flyher
Copy link

flyher commented May 14, 2021

I'm working in a project which query rows by raw sql

db.session.execute(sqltext, bind=db.get_engine(current_app, 'dbname')).fetchall()

after i update flask-sqlalchemy it show me the following error:

Traceback (most recent call last):
  File "***\lib\site-packages\flask\app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "***\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "***\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "***\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "***\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "***\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "***\lib\site-packages\flask\app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "***\backend\service\de.py", line 92, in get_detail_by_id
    rows_count = db.session.execute(
  File "<string>", line 2, in execute
  File "***\lib\site-packages\sqlalchemy\orm\session.py", line 1667, in execute
    bind = self.get_bind(**bind_arguments)
TypeError: get_bind() got an unexpected keyword argument 'bind'

And the bug seems as flask-sqlalchemy#issues/942

  • OS: Win10, Ubuntu20
  • Python version: 3.9.4, 3.9.1
  • Database: sqlite3

can't work well in

- Flask-SQLAlchemy version: 2.5.1
- SQLAlchemy version: 1.4.7

but work well in:

- Flask-SQLAlchemy version: 2.5.1
- SQLAlchemy version: 1.3.21


- Flask-SQLAlchemy version: 2.4.4
- SQLAlchemy version: 1.3.21

sqlalchemy sha1 #6930dfc032c3f9f474e71ab4e021c0ef8384930e

The line 1775 in 1.3.21:

if bind is None:
    bind = self.get_bind(mapper, clause=clause, **kw)

and in 1.4.15:

if bind is None:
    bind = self.get_bind(**bind_arguments)

sqlalchemy issues/6486

@esinker
Copy link

esinker commented May 18, 2021

The master branch seems to have changed ,but unfortunately, there is no release 。

@dpgaspar
Copy link

duplicate for #953

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants