Here's a full test.  Please modify this test script in order to reproduce your 
error.

# coding: utf-8

from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

engine = create_engine('sqlite:///', echo=True)

class Algoritimo(Base):
    __tablename__ = 'algoritimo'

    id = Column(Integer, primary_key=True)
    nomeAlgoritimo = Column(String(50))
    classe = Column(String(250))
    estruturaDados = Column(String(50))
    complexidadePiorCaso = Column(String(50))
    complexidadeMedioCaso = Column(String(50))
    complexidadeMelhorCaso = Column(String(50))
    complexidadeEspacos = Column(String(50))
    pseudoAlgoritimo = Column(String(4000))

Base.metadata.create_all(engine)

s = Session(engine)

s.add(Algoritimo())
s.commit()

algoritimo = s.query(Algoritimo).first()

algoritimo.complexidadeEspacos = u'O(n) total, O(1) auxiliar'
s.commit()



On May 26, 2014, at 3:40 PM, Afonso Rodrigues <[email protected]> 
wrote:

> but, I use: algoritimo.complexidadeEspacos = u'O(n) total, O(1) auxiliar'
> but the error continues.
> 
> 
> 2014-05-26 16:36 GMT-03:00 Michael Bayer <[email protected]>:
> that's a pysqlite error, not SQLAlchemy, please use Python unicode objects, 
> e.g. u'mystring', for unicode strings.
> 
> 
> On May 26, 2014, at 1:35 PM, Afonso Rodrigues 
> <[email protected]> wrote:
> 
>> Hi,
>> I using do SqlAlchemy with python 2.7.6
>> 
>> I came across:
>> 
>> sqlalchemy.exc.ProgrammingError: (ProgrammingError) You must not use 8-bit 
>> bytes
>> trings unless you use a text_factory that can interpret 8-bit bytestrings 
>> (like
>> text_factory = str). It is highly recommended that you instead just switch 
>> your
>> application to Unicode strings. u'INSERT INTO algoritimo ("nomeAlgoritimo", 
>> clas
>> se, "estruturaDados", "complexidadePiorCaso", "complexidadeMedioCaso", 
>> "complexi
>> dadeMelhorCaso", "complexidadeEspacos", "pseudoAlgoritimo") VALUES (?, ?, ?, 
>> ?,
>> ?, ?, ?, ?)' ('Ordena\xe7\xe3o Sele\xe7\xe3o', 'Algoritmo de 
>> oderna\xe7\xe3o', '
>> Array, Listas ligadas', 'O(n^2)', 'O(n^2)', 'O(n^2)', 'O(n) total, O(1) 
>> auxiliar
>> ', '')
>> 
>> I use:
>> 
>> Base = declarative_base()
>> engine = create_engine('sqlite:///classificacao_pesquisa.db')
>> 
>> class Algoritimo(Base):
>>      __tablename__ = 'algoritimo'
>> 
>>      id = Column(Integer, primary_key=True)
>>      nomeAlgoritimo = Column(String(50))
>>      classe = Column(String(250))
>>      estruturaDados = Column(String(50))
>>      complexidadePiorCaso = Column(String(50))
>>      complexidadeMedioCaso = Column(String(50))
>>      complexidadeMelhorCaso = Column(String(50))
>>      complexidadeEspacos = Column(String(50))
>>      pseudoAlgoritimo = Column(String(4000))
>> 
>> Do you have any tips?
>> Thank's
>> -- 
>> Atenciosamente, 
>> 
>> Afonso Rodrigues
>> Analista de Sistemas
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
> Atenciosamente, 
> 
> Afonso Rodrigues
> Analista de Sistemas
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to