misc: display last update time in a human format (#42447)
This commit is contained in:
parent
c7ebf40039
commit
a0cf6fb047
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import itertools
|
import itertools
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -526,6 +527,9 @@ class Engine(object):
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
return getattr(self.warehouse, name)
|
return getattr(self.warehouse, name)
|
||||||
|
|
||||||
|
def timestamp(self):
|
||||||
|
return datetime.datetime.fromtimestamp(self.warehouse.timestamp) if self.warehouse.timestamp else None
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def get_cursor(self):
|
def get_cursor(self):
|
||||||
with contextlib.closing(psycopg2.connect(self.warehouse.pg_dsn)) as connection:
|
with contextlib.closing(psycopg2.connect(self.warehouse.pg_dsn)) as connection:
|
||||||
|
|
Loading…
Reference in New Issue