Reputation: 21
I want to test BigQuery DataTransfer API in local but I encounter problems with library :
client = bigquery_datatransfer_v1.DataTransferServiceClient()
projectid = 'MyProjectID'
transferid = 'MyTransferID'
parent = client.transfer_config_path(projectid, transferid)
start_time = bigquery_datatransfer_v1.types.Timestamp(seconds=int(time.time() + 10))
response = client.start_manual_transfer_runs(parent, requested_run_time=start_time)
print(response)
Here are the problems encountered :
Module 'google.cloud.bigquery_datatransfer_v1.types' has no 'Timestamp'
And :
Unexpected keyword argument 'requested_run_time' in method call
Upvotes: 2
Views: 669
Reputation: 4032
In order to further contribute to the community, I am posting my suggestion as an answer. Once, you mentioned it worked for you.
As per the documentation, you should import the Timestamp package as follows,
from google.protobuf.timestamp_pb2 import Timestamp
After that, you will be able to use it as google.protobuf.timestamp_pb2.Timestamp
or as you wrote in your code. Both errors won't happen after you import the correct package.
Upvotes: 1