if a space in the DDL for a create table is actually significant to  
SQLite, then im not sure if i want to build that into the core.

also im not even sure what you really want, is it this?

NUMERIC (19,5)

anyway, i still dont understand why you dont make your own type.  by  
which I mean:

class MyType(types.Numeric):
    def get_col_spec(self):
         return "SOME_TOTALLY_NEW_TYPE "



On Mar 15, 2007, at 12:27 PM, Manlio Perillo wrote:

>
> Michael Bayer ha scritto:
>> the docs say "register_converter" is for custom types.  seems like
>> kind of a hack here ?
>
> As I can see, it is not an hack.
>
>> why not make your own type ?
>>
>
> I have tried to replace 'NUMERIC' with 'DECIMAL' or 'XDECIMAL';
> the result is the same: pysqlite converts the column's value to a  
> float.
>
> I do not understand this behaviour, however, as for SQLite docs[1],
> every user defined type has the NUMERIC affinity (this means that  
> SQLite
> treats it as a float, if the value can be converted to a float).
>
> It seems that the only solution is to register a custom converter, but
> SQLAlchemy *must* add a space before the '(' in the col_spec.
>
>
>
> [1]
> 2.1 Determination Of Column Affinity
>
> The type affinity of a column is determined by the declared type of  
> the
> column, according to the following rules:
>
>     1. If the datatype contains the string "INT" then it is assigned
> INTEGER affinity.
>
>     2. If the datatype of the column contains any of the strings  
> "CHAR",
> "CLOB", or "TEXT" then that column has TEXT affinity. Notice that the
> type VARCHAR contains the string "CHAR" and is thus assigned TEXT  
> affinity.
>
>     3. If the datatype for a column contains the string "BLOB" or  
> if no
> datatype is specified then the column has affinity NONE.
>
>     4. If the datatype for a column contains any of the strings  
> "REAL",
> "FLOA", or "DOUB" then the column has REAL affinity
>
>     5. Otherwise, the affinity is NUMERIC.
>
>
> So, it seems that pysqlite just enforces the type affinity converting
> the column's value to the correspondind Python type
> (NUMERIC -> REAL -> float).
>
>
> Thanks and regards   Manlio Perillo
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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