Text column not populating on object correctly

23 views
Skip to first unread message

jgruber

unread,
Jan 16, 2013, 11:42:38 PM1/16/13
to sqlal...@googlegroups.com
I'm using SQLAlchemy 7.8 with sqlite3. 

I have a Column setup in my schema of type Text, defined as follows: 

marker_data = Column(Text(length=None, convert_unicode=False, assert_unicode=None), nullable=False, unique=True)

I create my object and I see the SQL generated just fine.  I have an external sqlite client looking at the data and I see the table row populate correctly with the marker_data column when I create objects through SQLAlchemy and commit them.  However, the marker_data attribute on my python object for the Text fields is set to 'None' as soon as I commit or read it again from the db.

The text I put in is about 1700 characters and has '\n' characters in it. Removing the '\n' characters didn't change the behaviour.

When I use the engine by itself and do a raw query with engine.execute() the tuple data for the Text field comes back just fine.  It seems to be the ORM populating my object's marker_data attribute which isn't working? 

Any ideas?  How do I troubleshoot this further?

Thanks in advance...

Michael Bayer

unread,
Jan 16, 2013, 11:56:44 PM1/16/13
to sqlal...@googlegroups.com
there's something you're doing that is either setting this field to None or making it appear that way. would need more details (like a test case) to see exactly what it is.

jgruber

unread,
Jan 17, 2013, 1:22:54 AM1/17/13
to sqlal...@googlegroups.com
I complete ripped up my code..  Working back through an argument to __init__ the object which inherits from my data model.. DUH!

Thanks.. found it. You were create =None killed it..

John
Reply all
Reply to author
Forward
0 new messages