Change date definitions in Harvest Objects. reference_date -> metadata_modified_date, created -> gathered

This commit is contained in:
Adrià Mercader 2011-05-11 17:07:05 +01:00
parent e1080e349e
commit 26cdc1089d
3 changed files with 10 additions and 10 deletions

View File

@ -148,8 +148,8 @@ class CKANHarvester(SingletonPlugin):
# http://ec2-46-51-149-132.eu-west-1.compute.amazonaws.com:8081/api/2/rest/package/77d93608-3a3e-42e5-baab-3521afb504f1 # http://ec2-46-51-149-132.eu-west-1.compute.amazonaws.com:8081/api/2/rest/package/77d93608-3a3e-42e5-baab-3521afb504f1
package_dict = json.loads(harvest_object.content) package_dict = json.loads(harvest_object.content)
# Save reference date in Harvest Object # Save metadata modified date in Harvest Object
harvest_object.reference_date = package_dict['metadata_modified'] harvest_object.metadata_modified_date = package_dict['metadata_modified']
harvest_object.save() harvest_object.save()
## change default schema ## change default schema

View File

@ -326,15 +326,15 @@ def import_last_objects(source_id=None):
.filter(HarvestJob.source==source) \ .filter(HarvestJob.source==source) \
.filter(HarvestObject.package!=None) \ .filter(HarvestObject.package!=None) \
.order_by(HarvestObject.guid) \ .order_by(HarvestObject.guid) \
.order_by(HarvestObject.reference_date.desc()) \ .order_by(HarvestObject.metadata_modified_date.desc()) \
.order_by(HarvestObject.created.desc()) \ .order_by(HarvestObject.gathered.desc()) \
.all() .all()
else: else:
last_objects = Session.query(HarvestObject) \ last_objects = Session.query(HarvestObject) \
.filter(HarvestObject.package!=None) \ .filter(HarvestObject.package!=None) \
.order_by(HarvestObject.guid) \ .order_by(HarvestObject.guid) \
.order_by(HarvestObject.reference_date.desc()) \ .order_by(HarvestObject.metadata_modified_date.desc()) \
.order_by(HarvestObject.created.desc()) \ .order_by(HarvestObject.gathered.desc()) \
.all() .all()

View File

@ -119,13 +119,13 @@ harvest_job_table = Table('harvest_job', metadata,
harvest_object_table = Table('harvest_object', metadata, harvest_object_table = Table('harvest_object', metadata,
Column('id', types.UnicodeText, primary_key=True, default=make_uuid), Column('id', types.UnicodeText, primary_key=True, default=make_uuid),
Column('guid', types.UnicodeText, default=''), Column('guid', types.UnicodeText, default=''),
Column('reference_date', DateTime), Column('gathered', DateTime, default=datetime.datetime.utcnow),
Column('created', DateTime, default=datetime.datetime.utcnow),
Column('content', types.UnicodeText, nullable=True),
Column('harvest_job_id', types.UnicodeText, ForeignKey('harvest_job.id')),
Column('fetch_started', DateTime), Column('fetch_started', DateTime),
Column('content', types.UnicodeText, nullable=True),
Column('fetch_finished', DateTime), Column('fetch_finished', DateTime),
Column('metadata_modified_date', DateTime),
Column('retry_times',types.Integer), Column('retry_times',types.Integer),
Column('harvest_job_id', types.UnicodeText, ForeignKey('harvest_job.id')),
Column('package_id', types.UnicodeText, ForeignKey('package.id'), nullable=True), Column('package_id', types.UnicodeText, ForeignKey('package.id'), nullable=True),
) )
# New table # New table