GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(bigquery): add support of use_avro_logical_types for extract job… · okothchristopher/python-bigquery@d867d71

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • google/cloud/bigquery
    • job.py
  • tests/unit
    • test_job.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎google/cloud/bigquery/job.py‎

Copy file name to clipboardExpand all lines: google/cloud/bigquery/job.py
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ def time_partitioning(self, value):
13451345
@property
13461346
def use_avro_logical_types(self):
13471347
"""bool: For loads of Avro data, governs whether Avro logical types are
1348-
converted to their corresponding BigQuery types(e.g. TIMESTAMP) rather than
1348+
converted to their corresponding BigQuery types (e.g. TIMESTAMP) rather than
13491349
raw types (e.g. INTEGER).
13501350
"""
13511351
return self._get_sub_prop("useAvroLogicalTypes")
@@ -1938,6 +1938,18 @@ def print_header(self):
19381938
def print_header(self, value):
19391939
self._set_sub_prop("printHeader", value)
19401940

1941+
@property
1942+
def use_avro_logical_types(self):
1943+
"""bool: For loads of Avro data, governs whether Avro logical types are
1944+
converted to their corresponding BigQuery types (e.g. TIMESTAMP) rather than
1945+
raw types (e.g. INTEGER).
1946+
"""
1947+
return self._get_sub_prop("useAvroLogicalTypes")
1948+
1949+
@use_avro_logical_types.setter
1950+
def use_avro_logical_types(self, value):
1951+
self._set_sub_prop("useAvroLogicalTypes", bool(value))
1952+
19411953

19421954
class ExtractJob(_AsyncJob):
19431955
"""Asynchronous job: extract data from a table into Cloud Storage.
Collapse file

‎tests/unit/test_job.py‎

Copy file name to clipboardExpand all lines: tests/unit/test_job.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,6 +3036,7 @@ def test_to_api_repr(self):
30363036
config.field_delimiter = "ignored for avro"
30373037
config.print_header = False
30383038
config._properties["extract"]["someNewField"] = "some-value"
3039+
config.use_avro_logical_types = True
30393040
resource = config.to_api_repr()
30403041
self.assertEqual(
30413042
resource,
@@ -3046,6 +3047,7 @@ def test_to_api_repr(self):
30463047
"fieldDelimiter": "ignored for avro",
30473048
"printHeader": False,
30483049
"someNewField": "some-value",
3050+
"useAvroLogicalTypes": True,
30493051
}
30503052
},
30513053
)
@@ -3060,6 +3062,7 @@ def test_from_api_repr(self):
30603062
"fieldDelimiter": "\t",
30613063
"printHeader": True,
30623064
"someNewField": "some-value",
3065+
"useAvroLogicalTypes": False,
30633066
}
30643067
}
30653068
)
@@ -3068,6 +3071,7 @@ def test_from_api_repr(self):
30683071
self.assertEqual(config.field_delimiter, "\t")
30693072
self.assertEqual(config.print_header, True)
30703073
self.assertEqual(config._properties["extract"]["someNewField"], "some-value")
3074+
self.assertEqual(config.use_avro_logical_types, False)
30713075

30723076

30733077
class TestExtractJob(unittest.TestCase, _Base):

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.