superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnbod...@apache.org
Subject [incubator-superset] branch master updated: [logs] Dropping dt column (#4587)
Date Wed, 11 Apr 2018 01:34:35 GMT
This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f1d754  [logs] Dropping dt column (#4587)
7f1d754 is described below

commit 7f1d7543d05cedf5b5725b6da81943bd551ccc87
Author: John Bodley <4567245+john-bodley@users.noreply.github.com>
AuthorDate: Tue Apr 10 18:34:32 2018 -0700

    [logs] Dropping dt column (#4587)
---
 UPDATING.md                                   |  1 +
 superset/migrations/versions/30bb17c0dc76_.py | 26 ++++++++++++++++++++++++++
 superset/models/core.py                       |  5 ++---
 superset/views/core.py                        | 18 ------------------
 tests/base_tests.py                           |  1 -
 tests/security_tests.py                       |  1 -
 6 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/UPDATING.md b/UPDATING.md
index a5dbb34..e18409f 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -6,3 +6,4 @@ assists people when migrating to a new version.
 ## Superset 0.23.0
 
 * [4565](https://github.com/apache/incubator-superset/pull/4565)
+* [4587](https://github.com/apache/incubator-superset/pull/4587)
diff --git a/superset/migrations/versions/30bb17c0dc76_.py b/superset/migrations/versions/30bb17c0dc76_.py
new file mode 100644
index 0000000..c68255b
--- /dev/null
+++ b/superset/migrations/versions/30bb17c0dc76_.py
@@ -0,0 +1,26 @@
+"""empty message
+
+Revision ID: 30bb17c0dc76
+Revises: f231d82b9b26
+Create Date: 2018-04-08 07:34:12.149910
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '30bb17c0dc76'
+down_revision = 'f231d82b9b26'
+
+from datetime import date
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+    with op.batch_alter_table('logs') as batch_op:
+        batch_op.drop_column('dt')
+
+
+def downgrade():
+    with op.batch_alter_table('logs') as batch_op:
+        batch_op.add_column(sa.Column('dt', sa.Date,  default=date.today()))
diff --git a/superset/models/core.py b/superset/models/core.py
index 5ff737e..d826328 100644
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -6,7 +6,7 @@ from __future__ import print_function
 from __future__ import unicode_literals
 
 from copy import copy, deepcopy
-from datetime import date, datetime
+from datetime import datetime
 import functools
 import json
 import logging
@@ -20,7 +20,7 @@ import numpy
 import pandas as pd
 import sqlalchemy as sqla
 from sqlalchemy import (
-    Boolean, Column, create_engine, Date, DateTime, ForeignKey, Integer,
+    Boolean, Column, create_engine, DateTime, ForeignKey, Integer,
     MetaData, select, String, Table, Text,
 )
 from sqlalchemy.engine import url
@@ -865,7 +865,6 @@ class Log(Model):
     user = relationship(
         security_manager.user_model, backref='logs', foreign_keys=[user_id])
     dttm = Column(DateTime, default=datetime.utcnow)
-    dt = Column(Date, default=date.today())
     duration_ms = Column(Integer)
     referrer = Column(String(1024))
 
diff --git a/superset/views/core.py b/superset/views/core.py
index 7eb6d3a..6ffa4ee 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1474,24 +1474,6 @@ class Superset(BaseSupersetView):
 
     @api
     @has_access_api
-    @expose('/activity_per_day')
-    def activity_per_day(self):
-        """endpoint to power the calendar heatmap on the welcome page"""
-        Log = models.Log  # noqa
-        qry = (
-            db.session
-            .query(
-                Log.dt,
-                sqla.func.count())
-            .group_by(Log.dt)
-            .all()
-        )
-        payload = {str(time.mktime(dt.timetuple())):
-                   ccount for dt, ccount in qry if dt}
-        return json_success(json.dumps(payload))
-
-    @api
-    @has_access_api
     @expose('/schemas/<db_id>/')
     def schemas(self, db_id):
         db_id = int(db_id)
diff --git a/tests/base_tests.py b/tests/base_tests.py
index 3cec215..3c194bf 100644
--- a/tests/base_tests.py
+++ b/tests/base_tests.py
@@ -253,7 +253,6 @@ class SupersetTestCase(unittest.TestCase):
 
         self.assertIn(('can_add_slices', 'Superset'), gamma_perm_set)
         self.assertIn(('can_copy_dash', 'Superset'), gamma_perm_set)
-        self.assertIn(('can_activity_per_day', 'Superset'), gamma_perm_set)
         self.assertIn(('can_created_dashboards', 'Superset'), gamma_perm_set)
         self.assertIn(('can_created_slices', 'Superset'), gamma_perm_set)
         self.assertIn(('can_csv', 'Superset'), gamma_perm_set)
diff --git a/tests/security_tests.py b/tests/security_tests.py
index 58ec0c7..4e1597b 100644
--- a/tests/security_tests.py
+++ b/tests/security_tests.py
@@ -55,7 +55,6 @@ class RolePermissionTests(SupersetTestCase):
 
         self.assertIn(('can_add_slices', 'Superset'), perm_set)
         self.assertIn(('can_copy_dash', 'Superset'), perm_set)
-        self.assertIn(('can_activity_per_day', 'Superset'), perm_set)
         self.assertIn(('can_created_dashboards', 'Superset'), perm_set)
         self.assertIn(('can_created_slices', 'Superset'), perm_set)
         self.assertIn(('can_csv', 'Superset'), perm_set)

-- 
To stop receiving notification emails like this one, please contact
johnbodley@apache.org.

Mime
View raw message