_TextClause exception with text == 0
Hello,
I am having an error on a big sqlite database (260MB). When trying to reflect it ( records = sqlalchemy.Table('transactions', metadata, autoload=True) ) I get an error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\python25\lib\site-packages\sqlalchemy-0.6.1-py2.5.egg\sqlalchemy\schema.py", line 207, in new File "c:\python25\lib\site-packages\sqlalchemy-0.6.1-py2.5.egg\sqlalchemy\schema.py", line 261, in _init File "c:\python25\lib\site-packages\sqlalchemy-0.6.1-py2.5.egg\sqlalchemy\engine\base.py", line 1776, in reflecttable File "c:\python25\lib\site-packages\sqlalchemy-0.6.1-py2.5.egg\sqlalchemy\engine\default.py", line 206, in reflecttable File "c:\python25\lib\site-packages\sqlalchemy-0.6.1-py2.5.egg\sqlalchemy\engine\reflection.py", line 325, in reflecttable File "c:\python25\lib\site-packages\sqlalchemy-0.6.1-py2.5.egg\sqlalchemy\sql\expression.py", line 820, in text File "c:\python25\lib\site-packages\sqlalchemy-0.6.1-py2.5.egg\sqlalchemy\sql\expression.py", line 2364, in init TypeError: expected string or buffer
By looking deeper, it appears text is the 0 integer ... The issue is solved if I do this (before line 2364, SA 0.6.1):
if text == 0: text = ''
... then it reflects correctly.
The strange part is that using the same database when it was much smaller it worked perfectly (didnt event go to the _TextClause code).
Hth ...
Comments (5)
-
repo owner -
Account Deleted This didnt happen when my table was almost empty, but after lot of data on it it returned me an integer as the text variable. I could print it's type and it was an int. I checked the db integrity and it was ok.
-
repo owner OK nothing can be done here until a complete and succinct test script is provided which reproduces the issue. As it stands it looks like a simple case of reflection, the data in the table should have nothing to do with the results of reflection unless there's some odd sqlite bug at play.
-
repo owner - changed status to wontfix
k, no response on this for four months, no schema example, nothing we can do.
-
repo owner - removed milestone
Removing milestone: 0.6.xx (automated comment)
- Log in to comment
Can't reproduce on this end:
works fine, the "0" comes back as the string 0. Need to see the sqlite table construct which is producing this result.