In Python3 I tried the following with SQLAlchemy 0.7.2:
engine = sqlalchemy.create_engine("mysql+pymysql://root:123456@localhost/alchemy")
conn = engine.connect()
And got the following error:
File "/usr/local/.../pymysql/cursors.py", line 96, in execute
query = query % conn.escape(args)
TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'
Changing line 96 in cursors.py to
query = query.decode(charset) % conn.escape(args)
solved the problem.
Thanks I resolved too.
Python3 requires "pymysql3"
sudo pip install pymysql3==0.4
But why this isn't fixed in the code?
Still present in PyMySQL3==0.5. Resolved with @manubo's suggestion with a minor tweak: changing line 105 in cursors.py to:
query = query.decode(charset) % escaped_args
using conn.escape(args) didn't worked for me.
thanks a lot manubo it works perfect!!!
Patch file added for issue #83, PyMySQL#83
Fixed in a8dd44d.