Ejemplo n.º 1
0
def delete_data_with_wildcard(bq_client, dataset, condition, table_prefix, start_date, end_date):
    """Delete all the tables matching the wildcard table prefix.
  """
    table_list = table_list_handler.list_wildcard_table(
        bq_client, dataset, table_prefix, start_date, end_date, sys.maxint
    )
    __delete_data_process(bq_client, dataset, condition, table_list)
Ejemplo n.º 2
0
def copy_table_wildcard(
        bq_client, dataset, dest, table_prefix, start_date, end_date):
  """Copy the tables with name match given wildcard pattern.
  """
  table_list = table_list_handler.list_wildcard_table(
      bq_client,
      dataset,
      table_prefix,
      start_date,
      end_date,
      sys.maxint)
  _copy_table_list(bq_client, dataset, dest, table_list)
Ejemplo n.º 3
0
def delete_table_with_wildcard(bq_client,
                               dataset,
                               table_prefix,
                               start_date,
                               end_date,
                               ignore_confirm=False):
  """Delete all the tables matching the wildcard table prefix.
  """
  table_list = table_list_handler.list_wildcard_table(bq_client,
                                                      dataset,
                                                      table_prefix,
                                                      start_date,
                                                      end_date,
                                                      sys.maxint)
  _delete_table_list(bq_client, dataset, table_list, ignore_confirm)
Ejemplo n.º 4
0
def list_table(list_command):
  dataset = list_command.dataset
  limit = list_command.limit

  if isinstance(list_command, ListCommand):
    return table_list_handler.list_all_table(GOOGLE_BIGQUERY_CLIENT,
                                             dataset,
                                             limit)
  elif isinstance(list_command, ListRegexCommand):
    return table_list_handler.list_regex_table(GOOGLE_BIGQUERY_CLIENT,
                                               dataset,
                                               list_command.table_name_pattern,
                                               limit)
  elif isinstance(list_command, ListWildcardCommand):
    return table_list_handler.list_wildcard_table(GOOGLE_BIGQUERY_CLIENT,
                                                  dataset,
                                                  list_command.table_prefix,
                                                  list_command.start_date,
                                                  list_command.end_date,
                                                  limit)
  else:
    raise ValueError("Unrecognised command type.")