def __init__(self, **kwargs):
     MaterializerBase.__init__(self, **kwargs)
     self.headers = None
     resources_path = os.path.join(os.path.dirname(__file__),
                                   "../resources")
     with open(os.path.join(resources_path, 'country_to_id.json'),
               'r') as json_file:
         reader = json.load(json_file)
         self.country_to_id_map = reader
Beispiel #2
0
    def __init__(self, **kwargs):
        """ initialization and loading the city name to city id map

        """
        MaterializerBase.__init__(self, **kwargs)
        resources_path = os.path.join(os.path.dirname(__file__), "../resources")
        self.headers = {"token": DEFAULT_TOKEN}
        with open(os.path.join(resources_path, 'city_id_map.csv'), 'r') as csv_file:
            reader = csv.reader(csv_file)
            self.city_to_id_map = dict(reader)
 def __init__(self, **kwargs):
     MaterializerBase.__init__(self, **kwargs)
     self.type2parser = {
         'csv': CSVParser,
         'json': JSONParser,
         'xls': ExcelParser,
         'excel': ExcelParser,
         'asp': HTMLParser,
         'html': HTMLParser
     }
Beispiel #4
0
 def __init__(self):
     MaterializerBase.__init__(self)
     self.headers = None
     resources_path = os.path.join(os.path.dirname(__file__),
                                   "../resources")
     with open(os.path.join(resources_path, 'country_to_id.json'),
               'r') as json_file:
         reader = json.load(json_file)
         self.country_to_id_map = reader
         countrynames = self.country_to_id_map.keys()
         self.DEFAULT_LOCATIONS = list(countrynames)
Beispiel #5
0
    def __init__(self):
        """ initialization and loading the city name to city id map

        """
        MaterializerBase.__init__(self)
        self.conn = None
        try:
            # read connection parameters
            params = dict()
            params["dbname"] = DBNAME
            params["user"] = USER
            params["password"] = PASSWORD
            params["host"] = HOST

            # connect to the PostgreSQL server
            self.conn = psycopg2.connect(**params)

        except (Exception, psycopg2.DatabaseError) as error:
            print(error)
Beispiel #6
0
    def __init__(self, **kwargs):
        """ initialization and loading the city name to city id map

        """
        MaterializerBase.__init__(self, **kwargs)
    def __init__(self):
        """ initialization and loading the city name to city id map

        """
        MaterializerBase.__init__(self)
        self.key = None
Beispiel #8
0
 def __init__(self, **kwargs):
     MaterializerBase.__init__(self, **kwargs)
    def __init__(self, tmp_file_dir=None, **kwargs):
        MaterializerBase.__init__(self, **kwargs)
        tmp_file_dir = tmp_file_dir if tmp_file_dir else FbiMaterializer.TMP_FILE_DIR

        self.tmp_file_path = os.path.join(tmp_file_dir, "fbi_materializer_tmp")