On Sep 17, 4:21 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> some databases do accept VARCHAR without a length.

But the code I was looking at is in mysql.py, so I was assuming this
is where database-specific behavior goes.

>  Also, its a valid  
> use case to use String/VARCHAR by itself without a length if you're  
> using it in a CAST expression, as well as all the scenarios where you  
> are using it just for its type alone and not to generate the DDL  
> identifier.     So in this case the DBMS's exception is the best  
> exception to be raised (we usually try not to superimpose our own  
> exceptions on top of what the database reports just fine).

I've never used a CAST expression. Interesting... But, it looks like
'VARCHAR' is not a valid value for a CAST in MySQL: You can have CHAR
with or without a length, according to this page:

http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html

Your exception handling strategy makes good sense, in general. In this
case, I found the exception from the database to not be very helpful
with respect to actually fixing this problem. It complained about a
syntax error in a general area of the query. It didn't state anything
like "VARCHAR must have a length" or anything like that. And, to
compound the troubleshooting fun, when you use an abstraction like
SQLAlchemy you generally expect that the basics will "just work", even
more so since it had just worked for me in the past.

BTW, I should note that I'm just going to properly declare using
UnicodeText and be done with it, but the behavior of mysql.py in this
regard is suspect since it generates an expression that is not valid
for CAST or table creation.

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

Reply via email to