Discussion:
AttributeError: 'GenericTypeCompiler' object has no attribute 'visit_DOUBLE_PRECISION'
Jarrod Chesney
2010-10-02 21:30:37 UTC
Permalink
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?
--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to sqlalchemy+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Michael Bayer
2010-10-02 21:44:56 UTC
Permalink
Post by Jarrod Chesney
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.
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 ***@googlegroups.com.
To unsubscribe from this group, send email to sqlalchemy+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Jarrod Chesney
2010-10-02 23:18:13 UTC
Permalink
Thanks Michael
Is this in the manual anywhere?
Post by Jarrod Chesney
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.
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 ***@googlegroups.com.
To unsubscribe from this group, send email to sqlalchemy+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Michael Bayer
2010-10-02 23:33:34 UTC
Permalink
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.
Post by Jarrod Chesney
Thanks Michael
Is this in the manual anywhere?
Post by Michael Bayer
Post by Jarrod Chesney
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.
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.
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 ***@googlegroups.com.
To unsubscribe from this group, send email to sqlalchemy+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Michael Bayer
2010-10-03 17:13:07 UTC
Permalink
Post by Jarrod Chesney
Thanks Michael
Is this in the manual anywhere?
there's an enhancement in rcf4765de3a2b that looks at the type's __module__ for a sub-dialect and uses that sub-dialect for compilation in that case if no dialect specified otherwise.
Post by Jarrod Chesney
Post by Michael Bayer
Post by Jarrod Chesney
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.
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.
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 ***@googlegroups.com.
To unsubscribe from this group, send email to sqlalchemy+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Loading...