diff --git a/moto/glue/models.py b/moto/glue/models.py index 0f1467072..2b8648310 100644 --- a/moto/glue/models.py +++ b/moto/glue/models.py @@ -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 diff --git a/tests/test_glue/test_datacatalog.py b/tests/test_glue/test_datacatalog.py index 412b0dfd7..81c8f13e2 100644 --- a/tests/test_glue/test_datacatalog.py +++ b/tests/test_glue/test_datacatalog.py @@ -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"])