def run_query(self,<EOL>sql,<EOL>destination_dataset_table=None,<EOL>write_disposition='<STR_LIT>',<EOL>allow_large_results=False,<EOL>flatten_results=None,<EOL>udf_config=None,<EOL>use_legacy_sql=None,<EOL>maximum_billing_tier=None,<EOL>maximum_bytes_billed=None,<EOL>create_disposition='<STR_LIT>',<EOL>query_params=None,<EOL>labels=None,<EOL>schema_update_options=(),<EOL>priority='<STR_LIT>',<EOL>time_partitioning=None,<EOL>api_resource_configs=None,<EOL>cluster_fields=None,<EOL>location=None):
if time_partitioning is None:<EOL><INDENT>time_partitioning = {}<EOL><DEDENT>if location:<EOL><INDENT>self.location = location<EOL><DEDENT>if not api_resource_configs:<EOL><INDENT>api_resource_configs = self.api_resource_configs<EOL><DEDENT>else:<EOL><INDENT>_validate_value('<STR_LIT>',<EOL>api_resource_configs, dict)<EOL><DEDENT>configuration = deepcopy(api_resource_configs)<EOL>if '<STR_LIT>' not in configuration:<EOL><INDENT>configuration['<STR_LIT>'] = {}<EOL><DEDENT>else:<EOL><INDENT>_validate_value("<STR_LIT>",<EOL>configuration['<STR_LIT>'], dict)<EOL><DEDENT>if sql is None and not configuration['<STR_LIT>'].get('<STR_LIT>', None):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>allowed_schema_update_options = [<EOL>'<STR_LIT>', "<STR_LIT>"<EOL>]<EOL>if not set(allowed_schema_update_options<EOL>).issuperset(set(schema_update_options)):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format(schema_update_options,<EOL>allowed_schema_update_options))<EOL><DEDENT>if schema_update_options:<EOL><INDENT>if write_disposition not in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>if destination_dataset_table:<EOL><INDENT>destination_project, destination_dataset, destination_table =_split_tablename(table_input=destination_dataset_table,<EOL>default_project_id=self.project_id)<EOL>destination_dataset_table = {<EOL>'<STR_LIT>': destination_project,<EOL>'<STR_LIT>': destination_dataset,<EOL>'<STR_LIT>': destination_table,<EOL>}<EOL><DEDENT>if cluster_fields:<EOL><INDENT>cluster_fields = {'<STR_LIT>': cluster_fields}<EOL><DEDENT>query_param_list = [<EOL>(sql, '<STR_LIT>', None, six.string_types),<EOL>(priority, '<STR_LIT>', '<STR_LIT>', six.string_types),<EOL>(use_legacy_sql, '<STR_LIT>', self.use_legacy_sql, bool),<EOL>(query_params, '<STR_LIT>', None, list),<EOL>(udf_config, '<STR_LIT>', None, list),<EOL>(maximum_billing_tier, '<STR_LIT>', None, int),<EOL>(maximum_bytes_billed, '<STR_LIT>', None, float),<EOL>(time_partitioning, '<STR_LIT>', {}, dict),<EOL>(schema_update_options, '<STR_LIT>', None, tuple),<EOL>(destination_dataset_table, '<STR_LIT>', None, dict),<EOL>(cluster_fields, '<STR_LIT>', None, dict),<EOL>]<EOL>for param_tuple in query_param_list:<EOL><INDENT>param, param_name, param_default, param_type = param_tuple<EOL>if param_name not in configuration['<STR_LIT>'] and param in [None, {}, ()]:<EOL><INDENT>if param_name == '<STR_LIT>':<EOL><INDENT>param_default = _cleanse_time_partitioning(<EOL>destination_dataset_table, time_partitioning)<EOL><DEDENT>param = param_default<EOL><DEDENT>if param not in [None, {}, ()]:<EOL><INDENT>_api_resource_configs_duplication_check(<EOL>param_name, param, configuration['<STR_LIT>'])<EOL>configuration['<STR_LIT>'][param_name] = param<EOL>_validate_value(param_name, configuration['<STR_LIT>'][param_name],<EOL>param_type)<EOL>if param_name == '<STR_LIT>' and param:<EOL><INDENT>self.log.info("<STR_LIT>"<EOL>"<STR_LIT:%s>", schema_update_options)<EOL><DEDENT>if param_name == '<STR_LIT>':<EOL><INDENT>for key in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>if key not in configuration['<STR_LIT>']['<STR_LIT>']:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>configuration['<STR_LIT>'].update({<EOL>'<STR_LIT>': allow_large_results,<EOL>'<STR_LIT>': flatten_results,<EOL>'<STR_LIT>': write_disposition,<EOL>'<STR_LIT>': create_disposition,<EOL>})<EOL><DEDENT><DEDENT><DEDENT>if '<STR_LIT>' in configuration['<STR_LIT>'] and configuration['<STR_LIT>']['<STR_LIT>'] and'<STR_LIT>' in configuration['<STR_LIT>']:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if labels:<EOL><INDENT>_api_resource_configs_duplication_check(<EOL>'<STR_LIT>', labels, configuration)<EOL>configuration['<STR_LIT>'] = labels<EOL><DEDENT>return self.run_with_configuration(configuration)<EOL>
Executes a BigQuery SQL query. Optionally persists results in a BigQuery
table. See here:

https://cloud.google.com/bigquery/docs/reference/v2/jobs

For more details about these parameters.

:param sql: The BigQuery SQL to execute.
:type sql: str
:param destination_dataset_table: The dotted ``<dataset>.<table>``
    BigQuery table to save the query results.
:type destination_dataset_table: str
:param write_disposition: What to do if the table already exists in
    BigQuery.
:type write_disposition: str
:param allow_large_results: Whether to allow large results.
:type allow_large_results: bool
:param flatten_results: If true and query uses legacy SQL dialect, flattens
    all nested and repeated fields in the query results. ``allowLargeResults``
    must be true if this is set to false. For standard SQL queries, this
    flag is ignored and results are never flattened.
:type flatten_results: bool
:param udf_config: The User Defined Function configuration for the query.
    See https://cloud.google.com/bigquery/user-defined-functions for details.
:type udf_config: list
:param use_legacy_sql: Whether to use legacy SQL (true) or standard SQL (false).
    If `None`, defaults to `self.use_legacy_sql`.
:type use_legacy_sql: bool
:param api_resource_configs: a dictionary that contain params
    'configuration' applied for Google BigQuery Jobs API:
    https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs
    for example, {'query': {'useQueryCache': False}}. You could use it
    if you need to provide some params that are not supported by the
    BigQueryHook like args.
:type api_resource_configs: dict
:param maximum_billing_tier: Positive integer that serves as a
    multiplier of the basic price.
:type maximum_billing_tier: int
:param maximum_bytes_billed: Limits the bytes billed for this job.
    Queries that will have bytes billed beyond this limit will fail
    (without incurring a charge). If unspecified, this will be
    set to your project default.
:type maximum_bytes_billed: float
:param create_disposition: Specifies whether the job is allowed to
    create new tables.
:type create_disposition: str
:param query_params: a list of dictionary containing query parameter types and
    values, passed to BigQuery
:type query_params: list
:param labels: a dictionary containing labels for the job/query,
    passed to BigQuery
:type labels: dict
:param schema_update_options: Allows the schema of the destination
    table to be updated as a side effect of the query job.
:type schema_update_options: tuple
:param priority: Specifies a priority for the query.
    Possible values include INTERACTIVE and BATCH.
    The default value is INTERACTIVE.
:type priority: str
:param time_partitioning: configure optional time partitioning fields i.e.
    partition by field, type and expiration as per API specifications.
:type time_partitioning: dict
:param cluster_fields: Request that the result of this query be stored sorted
    by one or more columns. This is only available in combination with
    time_partitioning. The order of columns given determines the sort order.
:type cluster_fields: list[str]
:param location: The geographic location of the job. Required except for
    US and EU. See details at
    https://cloud.google.com/bigquery/docs/locations#specifying_your_location
:type location: str