add createtime to glue table response (#5245)
This commit is contained in:
parent
c2b1950698
commit
788e14ed40
@ -275,6 +275,7 @@ class FakeTable(BaseModel):
|
|||||||
self.database_name = database_name
|
self.database_name = database_name
|
||||||
self.name = table_name
|
self.name = table_name
|
||||||
self.partitions = OrderedDict()
|
self.partitions = OrderedDict()
|
||||||
|
self.created_time = datetime.utcnow()
|
||||||
self.versions = []
|
self.versions = []
|
||||||
self.update(table_input)
|
self.update(table_input)
|
||||||
|
|
||||||
@ -295,7 +296,11 @@ class FakeTable(BaseModel):
|
|||||||
raise VersionNotFoundException()
|
raise VersionNotFoundException()
|
||||||
|
|
||||||
def as_dict(self, version=-1):
|
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))
|
obj.update(self.get_version(version))
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ def test_delete_unknown_database():
|
|||||||
|
|
||||||
|
|
||||||
@mock_glue
|
@mock_glue
|
||||||
|
@freeze_time(FROZEN_CREATE_TIME)
|
||||||
def test_create_table():
|
def test_create_table():
|
||||||
client = boto3.client("glue", region_name="us-east-1")
|
client = boto3.client("glue", region_name="us-east-1")
|
||||||
database_name = "myspecialdatabase"
|
database_name = "myspecialdatabase"
|
||||||
@ -130,6 +131,9 @@ def test_create_table():
|
|||||||
response = helpers.get_table(client, database_name, table_name)
|
response = helpers.get_table(client, database_name, table_name)
|
||||||
table = response["Table"]
|
table = response["Table"]
|
||||||
|
|
||||||
|
if not settings.TEST_SERVER_MODE:
|
||||||
|
table["CreateTime"].should.equal(FROZEN_CREATE_TIME)
|
||||||
|
|
||||||
table["Name"].should.equal(table_input["Name"])
|
table["Name"].should.equal(table_input["Name"])
|
||||||
table["StorageDescriptor"].should.equal(table_input["StorageDescriptor"])
|
table["StorageDescriptor"].should.equal(table_input["StorageDescriptor"])
|
||||||
table["PartitionKeys"].should.equal(table_input["PartitionKeys"])
|
table["PartitionKeys"].should.equal(table_input["PartitionKeys"])
|
||||||
|
Loading…
Reference in New Issue
Block a user