Thank you Michael.

I've read the documentation that you quoted very carefully but still not
very sure in my case. You said that since 0.9.3 this issue has been
resolved, but I'm using 0.9.8 on Ubuntu and still get NullTypes. If I'm
using sqlalchemy MetaData.reflect() or automap extensions, together with
SQLite database, I do not need to worry about these Unicode issues? Is
there a newbie-friendly configuration step-by-step tutorial on this issue?
Thanks.

On Mon, Jan 5, 2015 at 4:56 PM, Michael Bayer <mike...@zzzcomputing.com>
wrote:

>
>
> Bao Niu <niuba...@gmail.com> wrote:
>
> >
> > I have a couple of questions regarding the Unicode/UnicodeText column
> type here.
> >
> > 1) I'm using Python 3, do I still need to explicitly use
> Unicode/UnicodeText type to define my columns? I thought Python 3
> inherently supports unicode?
>
> it does, but your database (often) does not.  the unicode-ness defines the
> storage of the type on the DB side, not as much the conversion on the
> Python side which you can get with convert_unicode=True.  Sqlite has native
> unicode on both py2k and py3k so not a big deal there.
>
> >
> > 2) If I use MetaData.reflect(), it seems to me that all the columns are
> reflected to be NullType(), regardless how I set it in the database. How
> can I overcome this?
>
> SQLite doesn’t have real “types”, so up until version 0.9.2 we only
> reflect whats given for a fixed set of names.  as of 0.9.3 we always
> resolve to an affinity so you should never get null type:
>
> http://docs.sqlalchemy.org/en/rel_0_9/dialects/sqlite.html#type-reflection
>
>
>
>
>
> > What I did is like this:
> > import sqlalchemy
> >
> >
> > eng = sqlalchemy.create_engine('sqlite:///foobar.db')
> > meta2 = sqlalchemy.MetaData(eng)
> > meta2.reflect()
> >
> > meta2.tables['entries'].c['foo'].type
> >
> >
> > and I got NullType here even though I'm pretty sure I defined it to
> unicode in my database.
> >
> > --
> > 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 sqlalchemy+unsubscr...@googlegroups.com.
> > To post to this group, send email to sqlalchemy@googlegroups.com.
> > 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 a topic in the
> Google Groups "sqlalchemy" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sqlalchemy/BrFN-qjkrqY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> 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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to