python - Encode a sqlalchemy text query -


i trying execute statement without success because get:

"unicodeencodeerror: 'ascii' codec can't encode character '\xc9' in position 276: ordinal not in range(128)"

my code is:

import sqlalchemy sa sqlalchemy.sql import text  engine = sa.create_engine("my connection (cannot show it)") conn = engine.connect() q = text("select * stores cadena = 'Élias'")  result = conn.execute(q).fetchall() print(result) 

as see, conditional of sql query has "É" cannot encoded.

what can solve this? if write .encode('utf-8') @ end of text, says

attributeerror: 'textclause' object has no attribute 'encode'

thanks in advance!


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -