Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 16 additions & 33 deletions bigquery/google/cloud/bigquery/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
from google.cloud.bigquery.table import TableReference


def _get_table_reference(self, table_id):
"""Constructs a TableReference.

Args:
table_id (str): The ID of the table.

Returns:
google.cloud.bigquery.table.TableReference:
A table reference for a table in this dataset.
"""
return TableReference(self, table_id)


class AccessEntry(object):
"""Represents grant of an access role to an entity.

Expand Down Expand Up @@ -191,17 +204,7 @@ def path(self):
"""str: URL path for the dataset based on project and dataset ID."""
return "/projects/%s/datasets/%s" % (self.project, self.dataset_id)

def table(self, table_id):
"""Constructs a TableReference.

Args:
table_id (str): The ID of the table.

Returns:
google.cloud.bigquery.table.TableReference:
A table reference for a table in this dataset.
"""
return TableReference(self, table_id)
table = _get_table_reference

@classmethod
def from_api_repr(cls, resource):
Expand Down Expand Up @@ -578,17 +581,7 @@ def _build_resource(self, filter_fields):

return partial

def table(self, table_id):
"""Constructs a TableReference.

Args:
table_id (str): the ID of the table.

Returns:
google.cloud.bigquery.table.TableReference:
A TableReference for a table in this dataset.
"""
return TableReference(self.reference, table_id)
table = _get_table_reference

def __repr__(self):
return "Dataset({})".format(repr(self.reference))
Expand Down Expand Up @@ -668,14 +661,4 @@ def reference(self):
"""
return DatasetReference(self.project, self.dataset_id)

def table(self, table_id):
"""Constructs a TableReference.

Args:
table_id (str): the ID of the table.

Returns:
google.cloud.bigquery.table.TableReference:
A TableReference for a table in this dataset.
"""
return TableReference(self.reference, table_id)
table = _get_table_reference