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 wrote:

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 NullType

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 Un

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=‘’; CREATE TABLE "persons" ("ID" ,"名" ,"中间名" ,"姓" ,"类别" ,"生日" ,"主要电话" ,"住宅传真" > ,"住宅地址国家地区" ,"住宅地址市县" ,"住宅地址街道" ,"住宅地址邮政编码" ,"住宅电话" ,"住宅电话2" ,"其他传真" > ,"其他地址国家地区" ,"其他地址市县" ,"其他地址省市自治区" ,"其他地址街道" ,"其他地址邮政编码" ,"其他电话" ,"办公地点" >

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=‘’; Bao Niu wrote: > Thank you Micha

Re: [sqlalchemy] Classic to declarative join tables problem

2015-01-07 Thread Michael Bayer
take a look at http://docs.sqlalchemy.org/en/rel_0_9/orm/nonstandard_mappings.html#mapping-a-class-against-multiple-tables for an example of declarative mapping to multiple tables. M3nt0r3 wrote: > Hi, > i am migrating from classic to declarative and i am stuck on this mapper. > > whit cla

[sqlalchemy] Classic to declarative join tables problem

2015-01-07 Thread M3nt0r3
Hi, i am migrating from classic to declarative and i am stuck on this mapper. whit classic mapper it works well. __table__ = Table('table2', params["metadata"], Column('id', Integer, primary_key=True), __table__ = Table('table1', params["metadata"], Column('id',Integer,Forei