mirror of
https://github.com/bspeice/metrik
synced 2024-11-23 07:38:09 -05:00
Add a 'now' tag to the database records
This commit is contained in:
parent
36ddd5d323
commit
cd7009729e
@ -24,5 +24,13 @@
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="quote_plus" />
|
||||
<option value="six.moves.urllib.parse" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -38,6 +38,12 @@
|
||||
<property name="caretWidth" class="java.lang.Integer" />
|
||||
</properties>
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<type id="django" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
|
@ -1,6 +1,7 @@
|
||||
from luigi import Target
|
||||
from pymongo import MongoClient
|
||||
from metrik.conf import MONGO_HOST, MONGO_PORT, MONGO_DATABASE
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class MongoTarget(Target):
|
||||
@ -18,6 +19,7 @@ class MongoTarget(Target):
|
||||
def persist(self, dict_object):
|
||||
id_dict = dict_object
|
||||
id_dict['_id'] = self.id
|
||||
id_dict['_retrieved'] = datetime.now()
|
||||
return self.collection.insert_one(id_dict).inserted_id
|
||||
|
||||
def retrieve(self):
|
||||
|
@ -1,14 +1,12 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import csv
|
||||
import pytz
|
||||
import requests
|
||||
from collections import namedtuple
|
||||
from dateutil.parser import parse
|
||||
from io import StringIO
|
||||
import logging
|
||||
|
||||
from luigi.parameter import DateParameter, Parameter
|
||||
# noinspection PyUnresolvedReferences
|
||||
from six.moves.urllib.parse import quote_plus
|
||||
|
||||
from metrik.tasks.base import MongoCreateTask
|
||||
|
Loading…
Reference in New Issue
Block a user