File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1071,6 +1071,14 @@ def to_bqstorage(self):
1071
1071
"""
1072
1072
return self .reference .to_bqstorage ()
1073
1073
1074
+ def to_api_repr (self ):
1075
+ """Constructs the API resource of this table
1076
+
1077
+ Returns:
1078
+ Dict[str, object]: Table represented as an API resource
1079
+ """
1080
+ return copy .deepcopy (self ._properties )
1081
+
1074
1082
1075
1083
def _row_from_mapping (mapping , schema ):
1076
1084
"""Convert a mapping to a row tuple using the schema.
Original file line number Diff line number Diff line change @@ -1433,6 +1433,17 @@ def test_labels_update_in_place(self):
1433
1433
labels ["foo" ] = "bar" # update in place
1434
1434
self .assertEqual (table .labels , {"foo" : "bar" })
1435
1435
1436
+ def test_to_api_repr (self ):
1437
+ resource = {
1438
+ "tableReference" : {
1439
+ "projectId" : "testproject" ,
1440
+ "datasetId" : "testdataset" ,
1441
+ "tableId" : "testtable" ,
1442
+ }
1443
+ }
1444
+ table = self ._make_one (resource )
1445
+ self .assertEqual (table .to_api_repr (), resource )
1446
+
1436
1447
1437
1448
class TestRow (unittest .TestCase ):
1438
1449
def test_row (self ):
You can’t perform that action at this time.
0 commit comments