Attributeerror: 'tuple' Object Has No Attribute 'keys'
I'm trying to insert some data to my table in MSSQL using flask+sqlalchemy. I'm using Python 3.4. My code: @main.route('/create-user', methods=['GET', 'POST']) def create_user():
Solution 1:
If you use named placeholders in your sql, you'll have to provide the parameters as keyword arguments.
So, e.g.:
engine.execute(text("... ((CONVERT(binary, :login)), (CONVERT(binary, :passwrd)))"),
login=login, passwrd=passwrd)
or, use positional placeholders:
engine.execute(text("... ((CONVERT(binary, %s)), (CONVERT(binary, %s)))"),
login, passwrd)
Depending on what mssql connector you're actually using, you might have to replace %s
with ?
in the latter case.
Post a Comment for "Attributeerror: 'tuple' Object Has No Attribute 'keys'"