Bump. Anyone know the answer?
On Wednesday, April 18, 2012 4:02:37 PM UTC-4, nick name wrote:
>
> A question I keep bugging (and submitting patches about) is the
> implementation of subsecond precision in the database. With the new code, I
> believe it is as simple as doing:
>
> def change_datetime_and_time_to_string(fields):
> for k, v in fields.items():
> if isinstance(v, (datetime.datetime, datetime.time)): fields[k] =
> v.isoformat().replace('T', ' ')
>
> _before_insert.append(change_datetime_and_time_to_string)
>
> Is there a reason not to do that?
>
> If not, would it be possible to make the DAL constructor append such a
> before_insert filter to any table? (As it is implemented, I would have to
> add it myself to tables that I want to apply it to).
> A filter such as the above could be useful if it comes by default (but not
> inserted to the _before_insert list). Another useful filter would warn or
> raise an error if the time or datetime has a nonzero microsecond field --
> useful for oracle or db2 which do not have that option.
>