[Tutor] Dates and databases, and blobs and Python.
shaleh at speakeasy.net
Sat Mar 26 17:42:15 CET 2005
Liam Clarke wrote:
> And then there's the overall question -
> What would be the least fiddly & least error prone way of working with
> dates and times? Python or SQL?
Liam, SQL is another language. You need to learn it like you are
learning Python. It has pretty decent support for dates and times as
part of the ANSI SQL spec.
There are defined types, SQL functions, etc.
week(date) = week(mydate) for instance.
I tend to prefer to write programming language agnostic databases
because that way I can interact with them from any random language I
need to. Sometimes things go bad and a quick little script which does:
rows = exec("select * from table")
for row in rows:
row = row + row - 5 # we decided on a new value
exec("update fields in table")
can be handy.
More information about the Tutor