From eba364d64a2e000faa105d13e7ac07f9f2bc72c8 Mon Sep 17 00:00:00 2001 From: Junxian Wu Date: Mon, 23 May 2016 17:56:01 -0700 Subject: [PATCH] fixed code style --- caravel/models.py | 4 ++-- caravel/views.py | 3 ++- caravel/viz.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/caravel/models.py b/caravel/models.py index 69b8aac5e13..b70d5d0155d 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -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 = { diff --git a/caravel/views.py b/caravel/views.py index aa82aacdec1..325fae53be9 100644 --- a/caravel/views.py +++ b/caravel/views.py @@ -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') diff --git a/caravel/viz.py b/caravel/viz.py index 22115d954b8..2825d7f89df 100644 --- a/caravel/viz.py +++ b/caravel/viz.py @@ -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)