Skip to content

Commit

Permalink
Merge branch 'main' into salem_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SalemJorden authored Jan 12, 2024
2 parents 43e9226 + cf920f4 commit a4e3115
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
[1]: https://pypi.org/project/google-cloud-bigquery/#history


## [3.16.0](https://github.com/googleapis/python-bigquery/compare/v3.15.0...v3.16.0) (2024-01-12)


### Features

* Add `table_constraints` field to Table model ([#1755](https://github.com/googleapis/python-bigquery/issues/1755)) ([a167f9a](https://github.com/googleapis/python-bigquery/commit/a167f9a95f0a8fbf0bdb4943d06f07c03768c132))
* Support jsonExtension in LoadJobConfig ([#1751](https://github.com/googleapis/python-bigquery/issues/1751)) ([0fd7347](https://github.com/googleapis/python-bigquery/commit/0fd7347ddb4ae1993f02b3bc109f64297437b3e2))


### Bug Fixes

* Add detailed message in job error ([#1762](https://github.com/googleapis/python-bigquery/issues/1762)) ([08483fb](https://github.com/googleapis/python-bigquery/commit/08483fba675f3b87571787e1e4420134a8fc8177))

## [3.15.0](https://github.com/googleapis/python-bigquery/compare/v3.14.1...v3.15.0) (2024-01-09)


Expand Down
13 changes: 13 additions & 0 deletions google/cloud/bigquery/job/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,19 @@ def ignore_unknown_values(self):
def ignore_unknown_values(self, value):
self._set_sub_prop("ignoreUnknownValues", value)

@property
def json_extension(self):
"""Optional[str]: The extension to use for writing JSON data to BigQuery. Only supports GeoJSON currently.
See: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.json_extension
"""
return self._get_sub_prop("jsonExtension")

@json_extension.setter
def json_extension(self, value):
self._set_sub_prop("jsonExtension", value)

@property
def max_bad_records(self):
"""Optional[int]: Number of invalid rows to ignore.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigquery/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "3.15.0"
__version__ = "3.16.0"
23 changes: 23 additions & 0 deletions tests/unit/job/test_load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,29 @@ def test_ignore_unknown_values_setter(self):
config.ignore_unknown_values = True
self.assertTrue(config._properties["load"]["ignoreUnknownValues"])

def test_json_extension_missing(self):
config = self._get_target_class()()
self.assertIsNone(config.json_extension)

def test_json_extension_hit(self):
config = self._get_target_class()()
config._properties["load"]["jsonExtension"] = "GEOJSON"
self.assertEqual(config.json_extension, "GEOJSON")

def test_json_extension_setter(self):
config = self._get_target_class()()
self.assertFalse(config.json_extension)
config.json_extension = "GEOJSON"
self.assertTrue(config.json_extension)
self.assertEqual(config._properties["load"]["jsonExtension"], "GEOJSON")

def test_to_api_repr_includes_json_extension(self):
config = self._get_target_class()()
config._properties["load"]["jsonExtension"] = "GEOJSON"
api_repr = config.to_api_repr()
self.assertIn("jsonExtension", api_repr["load"])
self.assertEqual(api_repr["load"]["jsonExtension"], "GEOJSON")

def test_max_bad_records_missing(self):
config = self._get_target_class()()
self.assertIsNone(config.max_bad_records)
Expand Down

0 comments on commit a4e3115

Please sign in to comment.