8000 BigQuery Job objects not pickle-able · Issue #5866 · googleapis/google-cloud-python · GitHub
[go: up one dir, main page]

Skip to content

BigQuery Job objects not pickle-able #5866

@max-sixty

Description

@max-sixty

@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

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0