add createtime to glue table response (#5245)

This commit is contained in:
diepholz 2022-06-20 17:29:16 -05:00 committed by GitHub
parent c2b1950698
commit 788e14ed40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -275,6 +275,7 @@ class FakeTable(BaseModel):
self.database_name = database_name
self.name = table_name
self.partitions = OrderedDict()
self.created_time = datetime.utcnow()
self.versions = []
self.update(table_input)
@ -295,7 +296,11 @@ class FakeTable(BaseModel):
raise VersionNotFoundException()
def as_dict(self, version=-1):
obj = {"DatabaseName": self.database_name, "Name": self.name}
obj = {
"DatabaseName": self.database_name,
"Name": self.name,
"CreateTime": self.created_time.isoformat(),
}
obj.update(self.get_version(version))
return obj

View File

@ -118,6 +118,7 @@ def test_delete_unknown_database():
@mock_glue
@freeze_time(FROZEN_CREATE_TIME)
def test_create_table():
client = boto3.client("glue", region_name="us-east-1")
database_name = "myspecialdatabase"
@ -130,6 +131,9 @@ def test_create_table():
response = helpers.get_table(client, database_name, table_name)
table = response["Table"]
if not settings.TEST_SERVER_MODE:
table["CreateTime"].should.equal(FROZEN_CREATE_TIME)
table["Name"].should.equal(table_input["Name"])
table["StorageDescriptor"].should.equal(table_input["StorageDescriptor"])
table["PartitionKeys"].should.equal(table_input["PartitionKeys"])