Skip to content

Commit

Permalink
update updated_on on update
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl Anderson committed Mar 4, 2013
1 parent 5972a07 commit f102eed
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mcso/pipelines.py
@@ -1,5 +1,6 @@
from scrapy.conf import settings
import os
import datetime
import common


Expand Down Expand Up @@ -29,7 +30,8 @@ def process_item(self, item, spider):
'assignedfac=?, '
'projreldate=?, parsed_projreldate=?, '
'releasedate=?, parsed_releasedate=?, '
'releasereason=?, mugshot_url=? '
'releasereason=?, mugshot_url=?, '
'updated_on=? '
'WHERE rowid=?',
(item.get('url'),
item.get('swisid'),
Expand All @@ -54,6 +56,7 @@ def process_item(self, item, spider):
item.parsed_date(item.get('releasedate')),
item.get('releasereason'),
item.get('mugshot_url'),
datetime.datetime.now(),
row_id))
else:
# new row
Expand All @@ -65,7 +68,8 @@ def process_item(self, item, spider):
'bookingdate, parsed_bookingdate, currentstatus, assignedfac, '
'projreldate, parsed_projreldate, '
'releasedate, parsed_releasedate, '
'releasereason, mugshot_url) '
'releasereason, mugshot_url, '
'updated_on) '
'VALUES '
'(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '
'?, ?, ?, ?, ?)',
Expand All @@ -86,7 +90,8 @@ def process_item(self, item, spider):
item.get('releasedate'),
item.parsed_date(item.get('releasedate')),
item.get('releasereason'),
item.get('mugshot_url')))
item.get('mugshot_url'),
datetime.datetime.now()))
# primary key is swisid + arrestdate
((row_id,),) = cursor.execute(
'SELECT rowid FROM bookings WHERE swisid=? AND arrestdate=?',
Expand Down

0 comments on commit f102eed

Please sign in to comment.