misc: display last update time in a human format (#42447)

This commit is contained in:
Frédéric Péters 2020-05-04 13:39:08 +02:00 committed by Benjamin Dauvergne
parent c7ebf40039
commit a0cf6fb047
1 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,7 @@
import collections
import contextlib
import datetime
import logging
import itertools
import hashlib
@ -526,6 +527,9 @@ class Engine(object):
def __getattr__(self, name):
return getattr(self.warehouse, name)
def timestamp(self):
return datetime.datetime.fromtimestamp(self.warehouse.timestamp) if self.warehouse.timestamp else None
@contextlib.contextmanager
def get_cursor(self):
with contextlib.closing(psycopg2.connect(self.warehouse.pg_dsn)) as connection: