Add glue.batch_get_partition endpoint
This commit is contained in:
parent
6bc07360a1
commit
c8d8aa4dd0
2 changed files with 74 additions and 0 deletions
|
|
@ -141,6 +141,23 @@ class GlueResponse(BaseResponse):
|
|||
|
||||
return json.dumps({'Partition': p.as_dict()})
|
||||
|
||||
def batch_get_partition(self):
|
||||
database_name = self.parameters.get('DatabaseName')
|
||||
table_name = self.parameters.get('TableName')
|
||||
partitions_to_get = self.parameters.get('PartitionsToGet')
|
||||
|
||||
table = self.glue_backend.get_table(database_name, table_name)
|
||||
|
||||
partitions = []
|
||||
for values in partitions_to_get:
|
||||
try:
|
||||
p = table.get_partition(values=values["Values"])
|
||||
partitions.append(p.as_dict())
|
||||
except PartitionNotFoundException:
|
||||
continue
|
||||
|
||||
return json.dumps({'Partitions': partitions})
|
||||
|
||||
def create_partition(self):
|
||||
database_name = self.parameters.get('DatabaseName')
|
||||
table_name = self.parameters.get('TableName')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue