A fix for this specific issue is in re8edc49d0ad7.  Note however that "BINARY" 
is not one of the type descriptors the SQLite dialect recognizes, so this 
reflects as NullType() on that backend (it always has).  SQlite uses a 
value-based type system so it doesn't actually matter all that much.



On Jan 12, 2011, at 4:54 PM, scott wrote:

> I'm trying to reflect a sqlite database with the hg tip, and it seems
> to fail whenever a BINARY column is present in the database. The same
> error happens whether reflecting the entire database at once (using
> metadata.reflect()) or just reflecting the specific table. A reduction
> with a traceback is below.
> 
> I don't really know enough about the types system to know if this is
> something I'm doing wrong or something sqlalchemy is doing wrong, but
> it seems to have been introduced in r7154: 
> http://hg.sqlalchemy.org/sqlalchemy/rev/e409e3adb99f
> 
> Thanks!
> Scott
> 
> 
> $ sqlite3 foo.db
> SQLite version 3.6.12
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> CREATE TABLE foo (bar BINARY(16));
> sqlite> .exit
> 
> $ python
> Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from sqlalchemy import create_engine, MetaData
>>>> engine = create_engine('sqlite:///foo.db')
>>>> meta = MetaData()
>>>> meta.reflect(bind=engine)
> .../sqlalchemy/lib/sqlalchemy/engine/reflection.py:46: SAWarning: Did
> not recognize type 'BINARY' of column 'bar'
>  ret = fn(self, con, *args, **kw)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File ".../sqlalchemy/lib/sqlalchemy/schema.py", line 2094, in
> reflect
>    Table(name, self, **reflect_opts)
>  File ".../sqlalchemy/lib/sqlalchemy/schema.py", line 212, in __new__
>    table._init(name, metadata, *args, **kw)
>  File ".../sqlalchemy/lib/sqlalchemy/schema.py", line 259, in _init
>    include_columns=include_columns)
>  File ".../sqlalchemy/lib/sqlalchemy/engine/base.py", line 1947, in
> reflecttable
>    self.dialect.reflecttable(conn, table, include_columns)
>  File ".../sqlalchemy/lib/sqlalchemy/engine/default.py", line 247, in
> reflecttable
>    return insp.reflecttable(table, include_columns)
>  File ".../sqlalchemy/lib/sqlalchemy/engine/reflection.py", line 382,
> in reflecttable
>    for col_d in self.get_columns(table_name, schema, **tblkw):
>  File ".../sqlalchemy/lib/sqlalchemy/engine/reflection.py", line 229,
> in get_columns
>    **kw)
>  File "<string>", line 1, in <lambda>
>  File ".../sqlalchemy/lib/sqlalchemy/engine/reflection.py", line 46,
> in cache
>    ret = fn(self, con, *args, **kw)
>  File ".../sqlalchemy/lib/sqlalchemy/dialects/sqlite/base.py", line
> 534, in get_columns
>    coltype = coltype(*[int(a) for a in args])
> TypeError: __init__() takes exactly 1 argument (2 given)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to