Load table data to :class:`EuroStatsValue` objects

def run(self):
        """Load table data to :class:`EuroStatsValue` objects
        """
        # -- start documentation include: eurostats-run-1
        # create a new indicator metadata object
        indicator = models.EuroStatIndicator(
            number=self.number,
            description=self.description,
            url="http://ec.europa.eu/eurostat/web/products-datasets/-/tgs" + self.number)

        # add/commit to get the object ID filled
        self.session.add(indicator)
        self.session.commit()
        # -- end documentation include: eurostats-run-1

        # -- start documentation include: eurostats-run-2
        # load data from input file task
        df = next(self.requires()).load(key_filter=self.key_filter,
                                        header_preproc=self.header_preproc)

        # Transform data: DataFrame from loading has NUTS2 key and years as columns.
        # Index by key, then stack years as second level of index. Reset the index
        # to get year and key as regular columns, with one value column left.
        values = df.set_index('key').stack()
        values.index.levels[1].name = 'year'
        values.name = 'value'
        df = values.reset_index()
        # -- end documentation include: eurostats-run-2

        # -- start documentation include: eurostats-run-3
        # get current max ID for EuroStatValue objects, for manual ID generation
        max_id = models.EuroStatValue.get_max_id(self.session)

        # append an ID column, starting with the current max ID of the object class plus one
        df['id'] = list(range(max_id + 1, max_id + 1 + len(df)))
        # -- end documentation include: eurostats-run-3

        # -- start documentation include: eurostats-run-4
        # append indicator ID (constant)
        df['indicator_id'] = indicator.id

        # append region ID column, by mapping NUTS2 region keys to DB object IDs
        regions = self.client.df_query(self.session.query(models.NUTS2Region)) \
            .set_index('key')['id']
        df['region_id'] = df['key'].map(regions)

        # drop columns that are not part of the data model
        df = df.drop(['key'], axis=1)  # type: pd.DataFrame
        # -- end documentation include: eurostats-run-4

        # -- start documentation include: eurostats-run-5
        # store, done
        df.to_sql(name=models.EuroStatValue.__tablename__,
                  con=client.get_client().engine,
                  if_exists='append',
                  index=False)

        self.done()