On Jun 6, 2006, at 12:21 AM, William K. Volkman wrote:

>
> Consider the fact that psycopg2 implements user defined data
> types.  Now how should a "TypePolicy" react to that?  Bottom line
> is that if someone has specialized needs for data type mapping
> let them override to get the expected behavior.  Please keep it
> out of the common code.


um, perhaps youre misunderstanding, we are only talking about being  
able to write database-agnostic code that expects a "float" to  
receive a "float", not a "Decimal", in all cases regardless of  
database being used.  Secondly, we are suggesting a method by which a  
user can specify that he or she would like particular types to be  
used when reflecting tables, rather than the default selection.   
Essentially, the ability to customize this map:

http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/lib/ 
sqlalchemy/databases/postgres.py#L122

so...you are free to choose to not override the mapping at all.

to interact with user defined types correctly would probably require  
a correspoinding custom TypeEngine class on the SA side of things to  
be created in any case.  in fact, to reflect postgres tables which do  
define custom datatypes, the custom type map feature would be  
*required* since some method would be needed to tell the postgres  
module about your custom type and what TypeEngine object should be  
used to deal with it on the python side.


_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to