To make mypy happy when I have an optional job_config, I'm having to write code like this:
if job_config is not None:
query_job = self.bqclient.query(sql, job_config=job_config)
else:
query_job = self.bqclient.query(sql)
This if/else should be unnecessary, but mypy complains that job_config argument to query can't be None.
The root cause is that the type annotation is only QueryJobConfig
|
job_config: QueryJobConfig = None, |
It should be Optional[QueryJobConfig].
This same issue occurs in copy_table and extract_table.
To make mypy happy when I have an optional
job_config, I'm having to write code like this:This if/else should be unnecessary, but mypy complains that
job_configargument toquerycan't beNone.The root cause is that the type annotation is only
QueryJobConfigpython-bigquery/google/cloud/bigquery/client.py
Line 3274 in 130450a
It should be
Optional[QueryJobConfig].This same issue occurs in
copy_tableandextract_table.