mirror of
https://github.com/apache/superset.git
synced 2026-06-08 00:59:17 +00:00
fixed code style
This commit is contained in:
@@ -428,10 +428,10 @@ class Database(Model, AuditMixinNullable):
|
||||
if self.sqlalchemy_uri.startswith(db_type):
|
||||
return grains
|
||||
|
||||
def dttm_converter(self, dttm, tf = None):
|
||||
def dttm_converter(self, dttm, tf=None):
|
||||
"""Returns a string that the database flavor understands as a date"""
|
||||
if tf is None or tf == '':
|
||||
tf = '%Y-%m-%d %H:%M:%S.%f'
|
||||
"""Returns a string that the database flavor understands as a date"""
|
||||
default = "'{}'".format(dttm.strftime(tf))
|
||||
iso = dttm.isoformat()
|
||||
d = {
|
||||
|
||||
@@ -290,7 +290,8 @@ class TableModelView(CaravelModelView, DeleteMixin): # noqa
|
||||
'table_name', 'database', 'schema', 'timestamp_format',
|
||||
'default_endpoint', 'offset', 'cache_timeout']
|
||||
edit_columns = [
|
||||
'table_name', 'is_featured', 'database', 'schema', 'timestamp_format', 'description', 'owner',
|
||||
'table_name', 'is_featured', 'database', 'schema',
|
||||
'timestamp_format', 'description', 'owner',
|
||||
'main_dttm_col', 'default_endpoint', 'offset', 'cache_timeout']
|
||||
related_views = [TableColumnInlineView, SqlMetricInlineView]
|
||||
base_order = ('changed_on', 'desc')
|
||||
|
||||
@@ -151,7 +151,8 @@ class BaseViz(object):
|
||||
raise Exception("No data, review your incantations!")
|
||||
else:
|
||||
if 'timestamp' in df.columns:
|
||||
df.timestamp = pd.to_datetime(df.timestamp, utc=False, format=timestamp_format)
|
||||
df.timestamp = pd.to_datetime(df.timestamp,
|
||||
utc=False, format=timestamp_format)
|
||||
if self.datasource.offset:
|
||||
df.timestamp += timedelta(hours=self.datasource.offset)
|
||||
df = df.fillna(0)
|
||||
|
||||
Reference in New Issue
Block a user