Re: [sqlalchemy] utf8 error upon insert

2016-06-10 Thread Ven Karri
upgrading pymysql did the trick. thank you. On Thursday, June 9, 2016 at 12:02:29 PM UTC-4, Mike Bayer wrote: > > > VARBINARY should not have a utf-8 encoding step at all. I can replace > VARBINARY directly in my script and there's no problem; can you upgrade > your pymysql? I seem to recall

Re: [sqlalchemy] utf8 error upon insert

2016-06-09 Thread Mike Bayer
VARBINARY should not have a utf-8 encoding step at all. I can replace VARBINARY directly in my script and there's no problem; can you upgrade your pymysql? I seem to recall someone having this problem recently. Also please run the script below (with your database URL) and send the full

Re: [sqlalchemy] utf8 error upon insert

2016-06-09 Thread Ven Karri
The only difference is that I am using sqlalchemy.types.VARBINARY(256) instead of String(255) On Thursday, June 9, 2016 at 10:47:32 AM UTC-4, Mike Bayer wrote: > > what charset is in your my.cnf and/or how are you connecting. Mine only > produces a warning. Here is an MCVE (definition: I can

Re: [sqlalchemy] utf8 error upon insert

2016-06-09 Thread Mike Bayer
what charset is in your my.cnf and/or how are you connecting. Mine only produces a warning. Here is an MCVE (definition: I can actually run it): from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class

Re: [sqlalchemy] utf8 error upon insert

2016-06-09 Thread Mike Bayer
On 06/09/2016 10:21 AM, Ven Karri wrote: Using, python 2.7 using 'mysql+pymysql' driver Code is very simple: gcm_key = '\xfeE\x87\xe7\xc9\xe5\xec\xe0\x9c\xd6\x85\x11\xc7\xebd\xe3\x7f\xd9\xfel\xe6\x86"j\xbe=\xf4\xd7\x95\x99F\x8f' model = Sample(gcm_key=gcm_key) session.add(model) Now what

Re: [sqlalchemy] utf8 error upon insert

2016-06-09 Thread Ven Karri
Any ideas? On Thursday, June 9, 2016 at 10:21:27 AM UTC-4, Ven Karri wrote: > > Using, python 2.7 using 'mysql+pymysql' driver > > Code is very simple: > > gcm_key = '\xfeE\x87\xe7\xc9\xe5\xec\xe0\x9c\xd6\x85\x11\xc7\xebd\ > xe3\x7f\xd9\xfel\xe6\x86"j\xbe=\xf4\xd7\x95\x99F\x8f' > model =

Re: [sqlalchemy] utf8 error upon insert

2016-06-09 Thread Ven Karri
Using, python 2.7 using 'mysql+pymysql' driver Code is very simple: gcm_key = '\xfeE\x87\xe7\xc9\xe5\xec\xe0\x9c\xd6\x85\x11\xc7\xebd\ xe3\x7f\xd9\xfel\xe6\x86"j\xbe=\xf4\xd7\x95\x99F\x8f' model = Sample(gcm_key=gcm_key) session.add(model) Now what you said is to make it u'some string'. The

Re: [sqlalchemy] utf8 error upon insert

2016-06-09 Thread Mike Bayer
On 06/09/2016 09:52 AM, Ven Karri wrote: I am getting a UTF-8 error upon insert using sql alchemy ORM. The same query runs fine when I run using raw sql. Here's the ORM query: rotating_keys_object = rotating_keys_model( gcm_key=rot_gcm_key, nonce=rot_nonce,