Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions google/cloud/bigquery/job/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,27 @@ def null_marker(self):
def null_marker(self, value):
self._set_sub_prop("nullMarker", value)

@property
def projection_fields(self):
"""Optional[List[str]]: If
Comment thread
plamut marked this conversation as resolved.
Outdated
:attr:`google.cloud.bigquery.job.LoadJobConfig.source_format` is set to
"DATASTORE_BACKUP", indicates which entity properties to load into
BigQuery from a Cloud Datastore backup.

Property names are case sensitive and must be top-level properties. If
no properties are specified, BigQuery loads all properties. If any
named property isn't found in the Cloud Datastore backup, an invalid
error is returned in the job result.

See:
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.projection_fields
"""
return self._get_sub_prop("projectionFields")

@projection_fields.setter
def projection_fields(self, value):
self._set_sub_prop("projectionFields", value)
Comment thread
plamut marked this conversation as resolved.

@property
def quote_character(self):
"""Optional[str]: Character used to quote data sections (CSV only).
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/job/test_load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,17 @@ def test_null_marker_setter(self):
config.null_marker = null_marker
self.assertEqual(config._properties["load"]["nullMarker"], null_marker)

def test_projection_fields_miss(self):
config = self._get_target_class()()
self.assertIsNone(config.projection_fields)

def test_projection_fields_hit(self):
config = self._get_target_class()()
fields = ["email", "postal_code"]
config.projection_fields = fields
self.assertEqual(config._properties["load"]["projectionFields"], fields)
self.assertEqual(config.projection_fields, fields)

def test_quote_character_missing(self):
config = self._get_target_class()()
self.assertIsNone(config.quote_character)
Expand Down