Content-Length: 341571 | pFad | https://github.com/googleapis/python-bigquery/commit/bd1da9aa0a40b02b7d5409a0b094d8380e255c91

C1 feat: add preserveAsciiControlCharacter to LoadJobConfig (#1484) · googleapis/python-bigquery@bd1da9a · GitHub
Skip to content

Commit bd1da9a

Browse files
authored
feat: add preserveAsciiControlCharacter to LoadJobConfig (#1484)
1 parent 2479394 commit bd1da9a

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

google/cloud/bigquery/job/load.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,19 @@ def null_marker(self):
311311
def null_marker(self, value):
312312
self._set_sub_prop("nullMarker", value)
313313

314+
@property
315+
def preserve_ascii_control_characters(self):
316+
"""Optional[bool]: Preserves the embedded ASCII control characters when sourceFormat is set to CSV.
317+
318+
See:
319+
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.preserve_ascii_control_characters
320+
"""
321+
return self._get_sub_prop("preserveAsciiControlCharacters")
322+
323+
@preserve_ascii_control_characters.setter
324+
def preserve_ascii_control_characters(self, value):
325+
self._set_sub_prop("preserveAsciiControlCharacters", bool(value))
326+
314327
@property
315328
def projection_fields(self) -> Optional[List[str]]:
316329
"""Optional[List[str]]: If

tests/unit/job/test_load_config.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,20 @@ def test_null_marker_setter(self):
424424
config.null_marker = null_marker
425425
self.assertEqual(config._properties["load"]["nullMarker"], null_marker)
426426

427+
def test_preserve_ascii_control_characters_missing(self):
428+
config = self._get_target_class()()
429+
self.assertIsNone(config.preserve_ascii_control_characters)
430+
431+
def test_preserve_ascii_control_characters_hit(self):
432+
config = self._get_target_class()()
433+
config._properties["load"]["preserveAsciiControlCharacters"] = True
434+
self.assertTrue(config.preserve_ascii_control_characters)
435+
436+
def test_preserve_ascii_control_characters_setter(self):
437+
config = self._get_target_class()()
438+
config.preserve_ascii_control_characters = True
439+
self.assertTrue(config._properties["load"]["preserveAsciiControlCharacters"])
440+
427441
def test_projection_fields_miss(self):
428442
config = self._get_target_class()()
429443
self.assertIsNone(config.projection_fields)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/python-bigquery/commit/bd1da9aa0a40b02b7d5409a0b094d8380e255c91

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy