def backfill_history(self, num_days, available_table_names):
if num_days == -<NUM_LIT:1>:<EOL><INDENT>logger.info('<STR_LIT>')<EOL>start_table = available_table_names[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>logger.info('<STR_LIT>', num_days)<EOL>start_table = available_table_names[-<NUM_LIT:1> * num_days]<EOL><DEDENT>start_date = self._datetime_for_table_name(start_table)<EOL>end_table = available_table_names[-<NUM_LIT:3>]<EOL>end_date = self._datetime_for_table_name(end_table)<EOL>logger.debug(<EOL>'<STR_LIT>', start_table,<EOL>start_date.strftime('<STR_LIT>'), end_table,<EOL>end_date.strftime('<STR_LIT>')<EOL>)<EOL>for days in range((end_date - start_date).days + <NUM_LIT:1>):<EOL><INDENT>backfill_dt = start_date + timedelta(days=days)<EOL>if self._have_cache_for_date(backfill_dt):<EOL><INDENT>logger.info('<STR_LIT>',<EOL>backfill_dt.strftime('<STR_LIT>'))<EOL>continue<EOL><DEDENT>backfill_table = self._table_name_for_datetime(backfill_dt)<EOL>logger.info('<STR_LIT>', backfill_table,<EOL>backfill_dt.strftime('<STR_LIT>'))<EOL>self.query_one_table(backfill_table)<EOL><DEDENT>
Backfill historical data for days that are missing.

:param num_days: number of days of historical data to backfill,
  if missing
:type num_days: int
:param available_table_names: names of available per-date tables
:type available_table_names: ``list``