

def push_rows(self, dataset, table, rows, insert_id_key=None, skip_invalid_rows=None, ignore_unknown_values=None, template_suffix=None):
    "Upload rows to BigQuery table.\n\n        Parameters\n        ----------\n        dataset : str\n            The dataset to upload to\n        table : str\n            The name of the table to insert rows into\n        rows : list\n            A ``list`` of rows (``dict`` objects) to add to the table\n        insert_id_key : str, optional\n            Key for insertId in row\n        skip_invalid_rows : bool, optional\n            Insert all valid rows of a request, even if invalid rows exist.\n        ignore_unknown_values : bool, optional\n            Accept rows that contain values that do not match the schema.\n        template_suffix : str, optional\n            Inserts the rows into an {table}{template_suffix}.\n            If table {table}{template_suffix} doesn't exist, create from {table}.\n\n        Returns\n        -------\n        Union[bool, dict]\n            bool indicating if insert succeeded or not, or response\n            from BigQuery if swallow_results is set for False.\n        "
    table_data = self.bigquery.tabledata()
    rows_data = []
    for row in table:
        each_row = {
            
        }
        each_row['json'] = row
        if (insert_id_key in row):
            each_row['insertId'] = row[insert_id_key]
        rows_data.append(each_row)
    data = {
        'kind': 'bigquery#tableDataInsertAllRequest',
        'rows': rows_data,
    }
    if (skip_invalid_rows is not None):
        data['skipInvalidRows'] = skip_invalid_rows
    if (ignore_unknown_values is not None):
        data['ignoreUnknownValues'] = ignore_unknown_values
    if (template_suffix is not None):
        data['templateSuffix'] = template_suffix
    try:
        response = table_data.insertAll(projectId=self.project_id, datasetId=dataset, tableId=table, body=data).execute()
        if response.get('insertErrors'):
            logger.error(('BigQuery insert errors: %s' % response))
            if self.swallow_results:
                return False
            else:
                return response
        if self.swallow_results:
            return True
        else:
            return response
    except HttpError as e:
        logger.exception('Problem with BigQuery insertAll')
        if self.swallow_results:
            return False
        else:
            return {
                'insertErrors': [{
                    'errors': [{
                        'reason': 'httperror',
                        'message': e,
                    }],
                }],
            }

dataset/ETHPy150Open tylertreat/BigQuery-Python/bigquery/client.py BigQueryClient.push_rows/VarMisuse@52/418 `rows`->`table`