Re: [sqlalchemy] Python 3, Unicode column types and MetaData.reflect()

2015-01-07 Thread Bao Niu
Thanks Michael. I should form a habit of trying it. It wasn't because I didn't want to, it was because I always fear that if I'm not careful with data I could ruin the precious data at one keystroke. So I kind of always ask before doing, lol. On Wed, Jan 7, 2015 at 3:47 PM, Michael Bayer

Re: [sqlalchemy] Python 3, Unicode column types and MetaData.reflect()

2015-01-07 Thread Michael Bayer
Hi Bao - Why don’t you just try it? As I’ve said, pysqlite returns unicode for strings already so the SQLAlchemy type isn’t really important except in some in-Python expression situations (like getting the + operator to do string concatenation). Your table is returning everything as

Re: [sqlalchemy] Python 3, Unicode column types and MetaData.reflect()

2015-01-07 Thread Bao Niu
Here is what I got from sqlite select sql from sqlite_master where name=‘tablename’; CREATE TABLE persons (ID ,名 ,中间名 ,姓 ,类别 ,生日 ,主要电话 ,住宅传真 ,住宅地址国家地区 ,住宅地址市县 ,住宅地址街道 ,住宅地址邮政编码 ,住宅电话 ,住宅电话2 ,其他传真 ,其他地址国家地区 ,其他地址市县 ,其他地址省市自治区 ,其他地址街道 ,其他地址邮政编码 ,其他电话 ,办公地点 ,单位 ,单位主要电话 ,商务传真 ,商务地址国家地区 ,商务地址市县

Re: [sqlalchemy] Python 3, Unicode column types and MetaData.reflect()

2015-01-07 Thread Bao Niu
Hi Michael, I don't have any problem having them all as NullType, but I just want to make sure the SQLite will deal with smoothly even when they are actually not NullType but Unicode/UnicodeText types. May I just go ahead and use NullType here instead of explicitly re-define all those columns as

Re: [sqlalchemy] Python 3, Unicode column types and MetaData.reflect()

2015-01-07 Thread Michael Bayer
the two cases where NullType() is still returned are if the type is defined as BLOB or as NULL in the SQLAlchemy database. change those and you won’t get any NullType. post your table defs here using: sqlite select sql from sqlite_master where name=‘tablename’; Bao Niu

Re: [sqlalchemy] Python 3, Unicode column types and MetaData.reflect()

2015-01-06 Thread Bao Niu
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,

[sqlalchemy] Python 3, Unicode column types and MetaData.reflect()

2015-01-05 Thread Bao Niu
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? 2) If I use MetaData.reflect(), it seems to me that all

Re: [sqlalchemy] Python 3, Unicode column types and MetaData.reflect()

2015-01-05 Thread Michael Bayer
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