On May 13, 2010, at 5:35 PM, Filippo Spiga wrote:
> On 12 Mag, 16:56, Michael Bayer <
mike...@zzzcomputing.com> wrote:
>> not sure what the question is here.
>>
>> TIMESTAMP will always generate TIMESTAMP on the DDL side if you use 0.6.
>>
>> In Python, you only have datetime.datetime() objects as actual values. There is no "TIMESTAMP" value-holding object in Python.
>
> So, I can define a table field as TIMESTAMP. Put an integer (a good
> one, rounding a float) during my INSERT operation and then, during a
> SELECT, SQLAlchemy (I'm using the 0.5.8) returns me a python DATETIME
> object. And finallyI have to convert it to an INTEGER using
> datetime.datetime methods (or time methods, I don't remember now). I
> understand that. Is it ok? Is it reasonable?
>
> At this point, can I store directly an integer value. It is probably
> faster, isn't it?
sure store an int if that's the way you're dealing with time values. You can also wrap the TIMESTAMP() type using TypeDecorator and convert from datetime to int (and back).