Re: [sqlalchemy] Sqlite date field

2011-06-19 Thread Mark Erbaugh

On Jun 19, 2011, at 10:06 AM, Michael Bayer wrote:

> Look into using a TypeDecorator around String.   
> 
> process_bind_param() and process_result_value() would coerce the data between 
> string / Python date.
> 
> http://www.sqlalchemy.org/docs/core/types.html#augmenting-existing-types
> some examples: 
> http://www.sqlalchemy.org/docs/core/types.html#typedecorator-recipes


Michael,

Thanks for the tip and the examples. I got a TypeDecorator working. My initial 
attempts failed as I was trying to descent from a Date class or use 
impl=types.Date.  When I switched to String, things worked better.

Mark

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] Sqlite date field

2011-06-19 Thread Michael Bayer
Look into using a TypeDecorator around String.   

process_bind_param() and process_result_value() would coerce the data between 
string / Python date.

http://www.sqlalchemy.org/docs/core/types.html#augmenting-existing-types
some examples: 
http://www.sqlalchemy.org/docs/core/types.html#typedecorator-recipes



On Jun 18, 2011, at 9:50 PM, Mark Erbaugh wrote:

> I have a legacy database where dates are stored in the format mm/dd/ 
> (i.e. 06/18/2011).  Is it possible to adapte the Sqlalchemy DATE() type to 
> use this format?  If not, is is possible to create a new class to handle this 
> format?
> 
> Thanks,
> Mark
> 
> -- 
> 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 
> 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 sqlalchemy@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.



[sqlalchemy] Sqlite date field

2011-06-18 Thread Mark Erbaugh
I have a legacy database where dates are stored in the format mm/dd/ (i.e. 
06/18/2011).  Is it possible to adapte the Sqlalchemy DATE() type to use this 
format?  If not, is is possible to create a new class to handle this format?

Thanks,
Mark

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.