def partition(dataset1, dataset2):
try:
client.get_dataset(dataset2)
print("Dataset {} already exists".format(dataset2))
except NotFound:
print("Dataset {} not found".format(dataset2))
createDataset(dataset2)
table = client.get_table(dataset1) # get the source dataset
partition_column = table.time_partitioning.field #get the column name
I tried using get_table description but it dint work out it was returning just none. And I got the docs link from googleapi link here How to get what type of partitioning is used by the table
You can use the following script to get the partition type :
table.time_partitioning.fieldgives the partition column nametable.time_partitioning.type_gives the partition type