Skip to content

Commit

Permalink
Add is_nullable method to check for NULLABLE mode
Browse files Browse the repository at this point in the history
Resolves: #3548
  • Loading branch information
Son CHU committed Jul 18, 2017
1 parent 9c06b35 commit c406610
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bigquery/google/cloud/bigquery/dbapi/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _set_description(self, schema):
internal_size=None,
precision=None,
scale=None,
null_ok=field.mode == 'NULLABLE')
null_ok=field.is_nullable)
for field in schema])

def _set_rowcount(self, query_results):
Expand Down
5 changes: 5 additions & 0 deletions bigquery/google/cloud/bigquery/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ def mode(self):
"""
return self._mode

@property
def is_nullable(self):
"""Check whether 'mode' is 'nullable'."""
return self._mode == 'NULLABLE'

@property
def description(self):
"""Optional[str]: Description for the field."""
Expand Down

0 comments on commit c406610

Please sign in to comment.