Skip to content

Commit c406610

Browse files
author
Son CHU
committed
Add is_nullable method to check for NULLABLE mode
Resolves: #3548
1 parent 9c06b35 commit c406610

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

bigquery/google/cloud/bigquery/dbapi/cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _set_description(self, schema):
7676
internal_size=None,
7777
precision=None,
7878
scale=None,
79-
null_ok=field.mode == 'NULLABLE')
79+
null_ok=field.is_nullable)
8080
for field in schema])
8181

8282
def _set_rowcount(self, query_results):

bigquery/google/cloud/bigquery/schema.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def mode(self):
6565
"""
6666
return self._mode
6767

68+
@property
69+
def is_nullable(self):
70+
"""Check whether 'mode' is 'nullable'."""
71+
return self._mode == 'NULLABLE'
72+
6873
@property
6974
def description(self):
7075
"""Optional[str]: Description for the field."""

0 commit comments

Comments
 (0)