@tseaver suggested I start a new issue after adding to a closed issue: #3191
BigQuery Job Objects are not pickle-able:
In [16]: job = client.copy_table(source_table,source_table)
In [17]: job
Out[17]: <google.cloud.bigquery.job.CopyJob at 0x1163a3320>
In [18]: pickle.dumps(job)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-18-0c1255e2d696> in <module>()
----> 1 pickle.dumps(job)
AttributeError: Can't pickle local object 'if_exception_type.<locals>.if_exception_type_predicate'
I'm guessing that's because it represents some sort of future? IMO it would be fine if __getstate__ deleted the polling and let a reference that could be checked.
@tseaver suggests:
As a workaround, you could pickle the result of job._to_api_repr, and then reconstitute it using client.job_from_resource.
which works. This could also be done by __getstate__ itself.
Thanks
@tseaver suggested I start a new issue after adding to a closed issue: #3191
BigQuery Job Objects are not pickle-able:
I'm guessing that's because it represents some sort of future? IMO it would be fine if
__getstate__deleted the polling and let a reference that could be checked.@tseaver suggests:
which works. This could also be done by
__getstate__itself.Thanks