no, its not ideal that a nicer message isn't raised so str() for types is not 
mentioned at all currently.   str() as a stringifier for types was only 
introduced in 0.6.4.   But you would get that error if you tried to call str() 
on any cast() function with a dialect-specific type previously.




On Oct 2, 2010, at 7:18 PM, Jarrod Chesney wrote:

> Thanks Michael
> Is this in the manual anywhere?
> 
> On Oct 3, 7:44 am, Michael Bayer <mike...@zzzcomputing.com> wrote:
>> On Oct 2, 2010, at 5:30 PM, Jarrod Chesney wrote:
>> 
>> 
>> 
>> 
>> 
>>> Hi All
>>> I'm reflecting a postgresql schema and then taking a str() of the
>>> column types, It goes well until it hits a "double" field type.
>> 
>>> here is the str of my reflected column object:
>>> set: set([Column(u'ASSET_ID', DOUBLE_PRECISION(precision=53,
>>> asdecimal=False), table=<tbl_SITES>)])
>> 
>>> Here is the stack trace
>>>  File "/home/jchesney/workspace_lin/rsconf/src/plugins/som/
>>> reconcile_schema/reconciler/objects/Column.py", line 35, in snapshot
>>>    column_record.type = str(column.type).partition('(')[0]
>>>  File "/home/jchesney/workspace_lin/sqlalchemy/lib/sqlalchemy/
>>> types.py", line 146, in __str__
>>>    return unicode(self.compile()).encode('ascii', 'backslashreplace')
>>>  File "/home/jchesney/workspace_lin/sqlalchemy/lib/sqlalchemy/
>>> types.py", line 140, in compile
>>>    return dialect.type_compiler.process(self)
>>>  File "/home/jchesney/workspace_lin/sqlalchemy/lib/sqlalchemy/engine/
>>> base.py", line 761, in process
>>>    return type_._compiler_dispatch(self)
>>>  File "/home/jchesney/workspace_lin/sqlalchemy/lib/sqlalchemy/sql/
>>> visitors.py", line 48, in _compiler_dispatch
>>>    return getter(visitor)(self, **kw)
>>> AttributeError: 'GenericTypeCompiler' object has no attribute
>>> 'visit_DOUBLE_PRECISION'
>> 
>>> Is this a SQLA bug?
>> 
>> nope, that's not a SQL standard type so it can't be rendered to string 
>> without a PG compiler.   from sqlalchemy.dialects import postgresql; 
>> str(type.compile(dialect=postgresql.dialect()))
> 
> -- 
> 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