[GitHub] jgbolger commented on issue #3464: Issue using Oracle DB as superset database - Error running a migration script
jgbolger commented on issue #3464: Issue using Oracle DB as superset database - Error running a migration script URL: https://github.com/apache/incubator-superset/issues/3464#issuecomment-330761000 Agreed This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] vnnw opened a new issue #3505: How to generate options for Filter
vnnw opened a new issue #3505: How to generate options for Filter URL: https://github.com/apache/incubator-superset/issues/3505 ### Superset version 0.19.1 ### Expected results When creating a new slice, the Filter drop-down menu show display choosable options. ### Actual results No available filter options. ### Steps to reproduce Create a new slice. ![image](https://user-images.githubusercontent.com/4979571/30634125-a3d27fac-9db3-11e7-9d2c-03bfa6314be8.png) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] xrmx commented on a change in pull request #3492: PandasConnector
xrmx commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139916372 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,724 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" +database_name = '' + +cache_timeout = None + +def __init__(self, database_name, cache_timeout): +self.database_name = database_name +self.cache_timeout = cache_timeout + +def __str__(self): +return self.database_name + + +class PandasColumn(Model, BaseColumn): +""" +ORM object for Pandas columns. + +Each Pandas Datasource can have multiple columns""" + +__tablename__ = 'pandascolumns' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('columns', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) + +@property +def is_num(self): +return self.type and is_numeric_dtype(self.type) + +@property +def is_time(self): +return self.type and is_datetime64_any_dtype(self.type) + +@property +def is_dttm(self): +return self.is_time + +@property +def is_string(self): +return self.type and is_string_dtype(self.type) + +num_types = ( +'DOUBLE', 'FLOAT', 'INT', 'BIGINT', +'LONG', 'REAL', 'NUMERIC', 'DECIMAL' +) +date_types = ('DATE', 'TIME', 'DATETIME') +str_types = ('VARCHAR', 'STRING', 'CHAR') + +@property +def expression(self): +return '' + +@property +def data(self): +attrs = ( +'column_name', 'verbose_name', 'description', 'expression', +'filterable', 'groupby') +return {s: getattr(self, s) for s in attrs} + + +class PandasMetric(Model, BaseMetric): +""" +ORM object for Pandas metrics. + +Each Pandas Datasource can have multiple metrics +""" + +__tablename__ = 'pandasmetrics' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('metrics', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) +source = Column(Text) +expression = Column(Text) + +@property +def perm(self): +if self.datasource: +return ('{parent_name}.[{obj.metric_name}]' +'(id:{obj.id})').format( +obj=self, +parent_name=self.datasource.full_name) +return None + + +class PandasDatasource(Model, BaseDatasource): +"""A datasource based on a Pandas DataFrame""" + +FORMATS = [ +('csv', 'CSV'), +('html', 'HTML') +] + +# See http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases # NOQA +GRAINS = OrderedDict([ +('5 seconds', '5S'), +('30 seconds', '30S'), +('1 minute', 'T'), +('5 minutes', '5T'), +('1 hour', 'H'), +('6 hour', '6H'), +('day', 'D'), +('one day', 'D'), +('1 day', 'D'), +('7 days', '7D'), +('week', 'W-MON'), +('week_starting_sunday', 'W-SUN'), +('week_ending_saturday', 'W-SUN'), +('month', 'M'), +('quarter', 'Q'), +('year', 'A'), +]) + +__tablename__ = 'pandasdatasources' +type = 'pandas' +baselink = 'pandasdatasourcemodelview' # url portion pointing to ModelView endpoint +column_class = PandasColumn +metric_class = PandasMetric + +name = Column(String(100), nullable=False) +source_url = Column(String(1000), nullable=False) +format = Column(String(20), nullable=False) +additional_parameters = Column(JSONType) + +user_id = Column(Integer, ForeignKey('ab_user.id')) +owner = relationship( +sm.user_model, +
[GitHub] xrmx commented on a change in pull request #3492: PandasConnector
xrmx commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139916514 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,724 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" +database_name = '' + +cache_timeout = None + +def __init__(self, database_name, cache_timeout): +self.database_name = database_name +self.cache_timeout = cache_timeout + +def __str__(self): +return self.database_name + + +class PandasColumn(Model, BaseColumn): +""" +ORM object for Pandas columns. + +Each Pandas Datasource can have multiple columns""" + +__tablename__ = 'pandascolumns' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('columns', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) + +@property +def is_num(self): +return self.type and is_numeric_dtype(self.type) + +@property +def is_time(self): +return self.type and is_datetime64_any_dtype(self.type) + +@property +def is_dttm(self): +return self.is_time + +@property +def is_string(self): +return self.type and is_string_dtype(self.type) + +num_types = ( +'DOUBLE', 'FLOAT', 'INT', 'BIGINT', +'LONG', 'REAL', 'NUMERIC', 'DECIMAL' +) +date_types = ('DATE', 'TIME', 'DATETIME') +str_types = ('VARCHAR', 'STRING', 'CHAR') + +@property +def expression(self): +return '' + +@property +def data(self): +attrs = ( +'column_name', 'verbose_name', 'description', 'expression', +'filterable', 'groupby') +return {s: getattr(self, s) for s in attrs} + + +class PandasMetric(Model, BaseMetric): +""" +ORM object for Pandas metrics. + +Each Pandas Datasource can have multiple metrics +""" + +__tablename__ = 'pandasmetrics' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('metrics', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) +source = Column(Text) +expression = Column(Text) + +@property +def perm(self): +if self.datasource: +return ('{parent_name}.[{obj.metric_name}]' +'(id:{obj.id})').format( +obj=self, +parent_name=self.datasource.full_name) +return None + + +class PandasDatasource(Model, BaseDatasource): +"""A datasource based on a Pandas DataFrame""" + +FORMATS = [ +('csv', 'CSV'), +('html', 'HTML') +] + +# See http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases # NOQA +GRAINS = OrderedDict([ +('5 seconds', '5S'), +('30 seconds', '30S'), +('1 minute', 'T'), +('5 minutes', '5T'), +('1 hour', 'H'), +('6 hour', '6H'), +('day', 'D'), +('one day', 'D'), +('1 day', 'D'), +('7 days', '7D'), +('week', 'W-MON'), +('week_starting_sunday', 'W-SUN'), +('week_ending_saturday', 'W-SUN'), +('month', 'M'), +('quarter', 'Q'), +('year', 'A'), +]) + +__tablename__ = 'pandasdatasources' +type = 'pandas' +baselink = 'pandasdatasourcemodelview' # url portion pointing to ModelView endpoint +column_class = PandasColumn +metric_class = PandasMetric + +name = Column(String(100), nullable=False) +source_url = Column(String(1000), nullable=False) +format = Column(String(20), nullable=False) +additional_parameters = Column(JSONType) + +user_id = Column(Integer, ForeignKey('ab_user.id')) +owner = relationship( +sm.user_model, +
[GitHub] xrmx commented on a change in pull request #3492: PandasConnector
xrmx commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139915471 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,724 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" +database_name = '' + +cache_timeout = None + +def __init__(self, database_name, cache_timeout): +self.database_name = database_name +self.cache_timeout = cache_timeout + +def __str__(self): +return self.database_name + + +class PandasColumn(Model, BaseColumn): +""" +ORM object for Pandas columns. + +Each Pandas Datasource can have multiple columns""" + +__tablename__ = 'pandascolumns' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('columns', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) + +@property +def is_num(self): +return self.type and is_numeric_dtype(self.type) + +@property +def is_time(self): +return self.type and is_datetime64_any_dtype(self.type) + +@property +def is_dttm(self): +return self.is_time + +@property +def is_string(self): +return self.type and is_string_dtype(self.type) + +num_types = ( +'DOUBLE', 'FLOAT', 'INT', 'BIGINT', +'LONG', 'REAL', 'NUMERIC', 'DECIMAL' +) +date_types = ('DATE', 'TIME', 'DATETIME') +str_types = ('VARCHAR', 'STRING', 'CHAR') + +@property +def expression(self): +return '' + +@property +def data(self): +attrs = ( +'column_name', 'verbose_name', 'description', 'expression', +'filterable', 'groupby') +return {s: getattr(self, s) for s in attrs} + + +class PandasMetric(Model, BaseMetric): +""" +ORM object for Pandas metrics. + +Each Pandas Datasource can have multiple metrics +""" + +__tablename__ = 'pandasmetrics' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('metrics', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) +source = Column(Text) +expression = Column(Text) + +@property +def perm(self): +if self.datasource: +return ('{parent_name}.[{obj.metric_name}]' +'(id:{obj.id})').format( +obj=self, +parent_name=self.datasource.full_name) +return None + + +class PandasDatasource(Model, BaseDatasource): +"""A datasource based on a Pandas DataFrame""" + +FORMATS = [ +('csv', 'CSV'), +('html', 'HTML') +] + +# See http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases # NOQA +GRAINS = OrderedDict([ +('5 seconds', '5S'), +('30 seconds', '30S'), +('1 minute', 'T'), +('5 minutes', '5T'), +('1 hour', 'H'), +('6 hour', '6H'), +('day', 'D'), +('one day', 'D'), +('1 day', 'D'), +('7 days', '7D'), +('week', 'W-MON'), +('week_starting_sunday', 'W-SUN'), +('week_ending_saturday', 'W-SUN'), +('month', 'M'), +('quarter', 'Q'), +('year', 'A'), +]) + +__tablename__ = 'pandasdatasources' +type = 'pandas' +baselink = 'pandasdatasourcemodelview' # url portion pointing to ModelView endpoint +column_class = PandasColumn +metric_class = PandasMetric + +name = Column(String(100), nullable=False) +source_url = Column(String(1000), nullable=False) +format = Column(String(20), nullable=False) +additional_parameters = Column(JSONType) + +user_id = Column(Integer, ForeignKey('ab_user.id')) +owner = relationship( +sm.user_model, +
[GitHub] xrmx commented on a change in pull request #3492: PandasConnector
xrmx commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139913251 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,724 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" +database_name = '' Review comment: i don't think you need to set defaults if they are not optional in __init__ This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] xrmx commented on a change in pull request #3492: PandasConnector
xrmx commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139912457 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,724 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" +database_name = '' + +cache_timeout = None + +def __init__(self, database_name, cache_timeout): +self.database_name = database_name +self.cache_timeout = cache_timeout + +def __str__(self): +return self.database_name + + +class PandasColumn(Model, BaseColumn): +""" +ORM object for Pandas columns. + +Each Pandas Datasource can have multiple columns""" + +__tablename__ = 'pandascolumns' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('columns', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) + +@property +def is_num(self): +return self.type and is_numeric_dtype(self.type) + +@property +def is_time(self): +return self.type and is_datetime64_any_dtype(self.type) + +@property +def is_dttm(self): +return self.is_time + +@property +def is_string(self): +return self.type and is_string_dtype(self.type) + +num_types = ( +'DOUBLE', 'FLOAT', 'INT', 'BIGINT', +'LONG', 'REAL', 'NUMERIC', 'DECIMAL' +) +date_types = ('DATE', 'TIME', 'DATETIME') +str_types = ('VARCHAR', 'STRING', 'CHAR') + +@property +def expression(self): +return '' + +@property +def data(self): +attrs = ( +'column_name', 'verbose_name', 'description', 'expression', +'filterable', 'groupby') +return {s: getattr(self, s) for s in attrs} + + +class PandasMetric(Model, BaseMetric): +""" +ORM object for Pandas metrics. + +Each Pandas Datasource can have multiple metrics +""" + +__tablename__ = 'pandasmetrics' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('metrics', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) +source = Column(Text) +expression = Column(Text) + +@property +def perm(self): +if self.datasource: +return ('{parent_name}.[{obj.metric_name}]' +'(id:{obj.id})').format( +obj=self, +parent_name=self.datasource.full_name) +return None + + +class PandasDatasource(Model, BaseDatasource): +"""A datasource based on a Pandas DataFrame""" + +FORMATS = [ +('csv', 'CSV'), +('html', 'HTML') +] + +# See http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases # NOQA +GRAINS = OrderedDict([ +('5 seconds', '5S'), +('30 seconds', '30S'), +('1 minute', 'T'), +('5 minutes', '5T'), +('1 hour', 'H'), +('6 hour', '6H'), +('day', 'D'), +('one day', 'D'), +('1 day', 'D'), +('7 days', '7D'), +('week', 'W-MON'), +('week_starting_sunday', 'W-SUN'), +('week_ending_saturday', 'W-SUN'), +('month', 'M'), +('quarter', 'Q'), +('year', 'A'), +]) + +__tablename__ = 'pandasdatasources' +type = 'pandas' +baselink = 'pandasdatasourcemodelview' # url portion pointing to ModelView endpoint +column_class = PandasColumn +metric_class = PandasMetric + +name = Column(String(100), nullable=False) +source_url = Column(String(1000), nullable=False) +format = Column(String(20), nullable=False) +additional_parameters = Column(JSONType) + +user_id = Column(Integer, ForeignKey('ab_user.id')) +owner = relationship( +sm.user_model, +
[GitHub] xrmx commented on a change in pull request #3492: PandasConnector
xrmx commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139914425 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,724 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" +database_name = '' + +cache_timeout = None + +def __init__(self, database_name, cache_timeout): +self.database_name = database_name +self.cache_timeout = cache_timeout + +def __str__(self): +return self.database_name + + +class PandasColumn(Model, BaseColumn): +""" +ORM object for Pandas columns. + +Each Pandas Datasource can have multiple columns""" + +__tablename__ = 'pandascolumns' Review comment: We may want to be consistent with sqla backend and call it 'pandas_columns' This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] xrmx commented on a change in pull request #3492: PandasConnector
xrmx commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139923359 ## File path: contrib/connectors/pandas/views.py ## @@ -0,0 +1,270 @@ +"""Views used by the SqlAlchemy connector""" +import logging + +from past.builtins import basestring + +from flask import Markup, flash, redirect +from flask_appbuilder import CompactCRUDMixin, expose +from flask_appbuilder.models.sqla.interface import SQLAInterface +import sqlalchemy as sa + +from flask_babel import lazy_gettext as _ +from flask_babel import gettext as __ + +from superset import appbuilder, db, utils, security, sm +from superset.utils import has_access +from superset.connectors.base.views import DatasourceModelView +from superset.views.base import ( +SupersetModelView, ListWidgetWithCheckboxes, DeleteMixin, DatasourceFilter, +get_datasource_exist_error_mgs, +) + +from . import models + + +class PandasColumnInlineView(CompactCRUDMixin, SupersetModelView): # noqa +datamodel = SQLAInterface(models.PandasColumn) + +list_title = _('List Columns') +show_title = _('Show Column') +add_title = _('Add Column') +edit_title = _('Edit Column') + +can_delete = False +list_widget = ListWidgetWithCheckboxes +edit_columns = [ +'column_name', 'verbose_name', 'description', +'type', 'groupby', 'filterable', +'datasource', 'count_distinct', 'sum', 'min', 'max'] +add_columns = edit_columns +list_columns = [ +'column_name', 'verbose_name', 'type', 'groupby', 'filterable', +'count_distinct', 'sum', 'min', 'max'] +page_size = 500 +description_columns = { +'is_dttm': _( +"Whether to make this column available as a " +"[Time Granularity] option, column has to be DATETIME or " +"DATETIME-like"), +'filterable': _( +"Whether this column is exposed in the `Filters` section " +"of the explore view."), +'type': _( +"The data type that was inferred by Pandas. " +"It may be necessary to input a type manually for " +"expression-defined columns in some cases. In most case " +"users should not need to alter this."), +} +label_columns = { +'column_name': _("Column"), +'verbose_name': _("Verbose Name"), +'description': _("Description"), +'groupby': _("Groupable"), +'filterable': _("Filterable"), +'datasource': _("Datasource"), +'count_distinct': _("Count Distinct"), +'sum': _("Sum"), +'min': _("Min"), +'max': _("Max"), +'type': _('Type'), +} + + +appbuilder.add_view_no_menu(PandasColumnInlineView) + + +class PandasMetricInlineView(CompactCRUDMixin, SupersetModelView): # noqa +datamodel = SQLAInterface(models.PandasMetric) + +list_title = _('List Metrics') +show_title = _('Show Metric') +add_title = _('Add Metric') +edit_title = _('Edit Metric') + +list_columns = ['metric_name', 'verbose_name', 'metric_type'] +edit_columns = [ +'metric_name', 'description', 'verbose_name', 'metric_type', +'source', 'expression', 'datasource', 'd3format', 'is_restricted'] +description_columns = { +'source': utils.markdown( +"a comma-separated list of column(s) used to calculate " +" the metric. Example: `claim_amount`", True), +'expression': utils.markdown( +"a valid Pandas expression as supported by the underlying " +"backend. Example: `count()`", True), +'is_restricted': _("Whether the access to this metric is restricted " + "to certain roles. Only roles with the permission " + "'metric access on XXX (the name of this metric)' " + "are allowed to access this metric"), +'d3format': utils.markdown( +"d3 formatting string as defined [here]" +"(https://github.com/d3/d3-format/blob/master/README.md#format). " +"For instance, this default formatting applies in the Table " +"visualization and allow for different metric to use different " +"formats", True +), +} +add_columns = edit_columns +page_size = 500 +label_columns = { +'metric_name': _("Metric"), +'description': _("Description"), +'verbose_name': _("Verbose Name"), +'metric_type': _("Type"), +'source': _("Pandas Source Columns"), +'expression': _("Pandas Expression"), +'datasource': _("Datasource"), +'d3format': _("D3 Format"), +'is_restricted': _('Is Restricted') +} + +def post_add(self, metric): +if metric.is_restricted: +security.merge_perm(sm, 'metric_access', metric.get_perm()) + +def post_update(self, metric): +if
[GitHub] JazzChen commented on issue #2467: Change the setting of superset from sqlite to MySQL - a problem!
JazzChen commented on issue #2467: Change the setting of superset from sqlite to MySQL - a problem! URL: https://github.com/apache/incubator-superset/issues/2467#issuecomment-330809380 after removing ~/.superset/superset.db, it works This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] xrmx commented on issue #3492: PandasConnector
xrmx commented on issue #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#issuecomment-330802684 Thanks a lot for your great work, i'd really like this to be a first citizen in superset This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] vnnw closed issue #3505: How to generate options for Filter
vnnw closed issue #3505: How to generate options for Filter URL: https://github.com/apache/incubator-superset/issues/3505 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] vnnw commented on issue #3505: How to generate options for Filter
vnnw commented on issue #3505: How to generate options for Filter URL: https://github.com/apache/incubator-superset/issues/3505#issuecomment-330784954 Sorry, it is my bad. I didn't check "Enable Filter Select" in Edit Table - Detail. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3390: js translation -- performance improvment
coveralls commented on issue #3390: js translation -- performance improvment URL: https://github.com/apache/incubator-superset/pull/3390#issuecomment-330946487 [![Coverage Status](https://coveralls.io/builds/13359071/badge)](https://coveralls.io/builds/13359071) Coverage increased (+0.08%) to 69.535% when pulling **2d977b9d0908dbc389e8410d3b6eeb1e7b7698fb on graceguo-supercat:lxzhangchao-js_po_translation** into **ed9f56448f39aab9e9bbb331d008390dd63d9b21 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] benvogan commented on issue #3502: Time Series Annotation Layer
benvogan commented on issue #3502: Time Series Annotation Layer URL: https://github.com/apache/incubator-superset/issues/3502#issuecomment-330933218 This would be a pretty awesome feature. We are currently using Metric Insights for this kind of use case. What we do is put events on a Google Calendar and associate that to an "annotation layer". People can then see these things in both their calendar app and overlayed on any visualization. The way it is done in Metric Insights are little triangles at the top of the chart (or bars depending on the event timeframe) and mousing over them shows the text entered into the event. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rhunwicks commented on issue #3302: Create a PandasDatasource
rhunwicks commented on issue #3302: Create a PandasDatasource URL: https://github.com/apache/incubator-superset/issues/3302#issuecomment-330914411 > Is it important that when is_timeseries == True the rows are returned in __timestamp order? I think not, because it looks like 816c517 has made `is_timeseries` without a `groupby` also use `main_metric_expr` for ordering. I'll update the tests in the PR to account for that. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Todd-Z-Li opened a new issue #3507: Cannot Get to Slices Page after Bad Slice Data Edit (tried to add new property to hide scroll bars)
Todd-Z-Li opened a new issue #3507: Cannot Get to Slices Page after Bad Slice Data Edit (tried to add new property to hide scroll bars) URL: https://github.com/apache/incubator-superset/issues/3507 Make sure these boxes are checked before submitting your issue - thank you! - [x] I have checked the superset logs for python stacktraces and included it here as text if any - [x] I have reproduced the issue with at least the latest released version of superset - [x] I have checked the issue tracker for the same issue and I haven't found one similar ### Superset version 0.18.5 ### Expected results List of Slices ### Actual results `Traceback (most recent call last): File "/home/pi/venv/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/home/pi/venv/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/pi/venv/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/pi/venv/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise raise value File "/home/pi/venv/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/home/pi/venv/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/pi/venv/lib/python3.5/site-packages/flask_appbuilder/security/decorators.py", line 26, in wraps return f(self, *args, **kwargs) File "/home/pi/venv/lib/python3.5/site-packages/flask_appbuilder/views.py", line 478, in list widgets=widgets) File "/home/pi/venv/lib/python3.5/site-packages/flask_appbuilder/baseviews.py", line 158, in render_template return render_template(template, **dict(list(kwargs.items()) + list(self.extra_args.items( File "/home/pi/venv/lib/python3.5/site-packages/flask/templating.py", line 134, in render_template context, ctx.app) File "/home/pi/venv/lib/python3.5/site-packages/flask/templating.py", line 116, in _render rv = template.render(context) File "/home/pi/venv/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render return self.environment.handle_exception(exc_info, True) File "/home/pi/venv/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb) File "/home/pi/venv/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise raise value.with_traceback(tb) File "/home/pi/venv/lib/python3.5/site-packages/superset/templates/appbuilder/general/model/list.html", line 2, in top-level template code {% import 'appbuilder/general/lib.html' as lib %} File "/home/pi/venv/lib/python3.5/site-packages/flask_appbuilder/templates/appbuilder/base.html", line 1, in top-level template code {% extends base_template %} File "/home/pi/venv/lib/python3.5/site-packages/superset/templates/superset/base.html", line 1, in top-level template code {% extends "appbuilder/baselayout.html" %} File "/home/pi/venv/lib/python3.5/site-packages/superset/templates/appbuilder/baselayout.html", line 2, in top-level template code {% import 'appbuilder/baselib.html' as baselib %} File "/home/pi/venv/lib/python3.5/site-packages/flask_appbuilder/templates/appbuilder/init.html", line 46, in top-level template code {% block body %} File "/home/pi/venv/lib/python3.5/site-packages/superset/templates/appbuilder/baselayout.html", line 21, in block "body" {% block content %} File "/home/pi/venv/lib/python3.5/site-packages/superset/templates/appbuilder/general/model/list.html", line 12, in block "content" {% block list_list scoped %} File "/home/pi/venv/lib/python3.5/site-packages/superset/templates/appbuilder/general/model/list.html", line 13, in block "list_list" {{ widgets.get('list')()|safe }} File "/home/pi/venv/lib/python3.5/site-packages/flask_appbuilder/widgets.py", line 34, in __call__ return template.render(args) File "/home/pi/venv/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render return self.environment.handle_exception(exc_info, True) File "/home/pi/venv/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb) File "/home/pi/venv/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise raise value.with_traceback(tb) File "/home/pi/venv/lib/python3.5/site-packages/flask_appbuilder/templates/appbuilder/general/widgets/list.html", line 2, in top-level template code {% extends
[GitHub] laresbernardo commented on issue #550: Dashboard Access Control to specific user
laresbernardo commented on issue #550: Dashboard Access Control to specific user URL: https://github.com/apache/incubator-superset/issues/550#issuecomment-330980896 Same here! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball commented on issue #3473: Feature: Paired t-test table visualization
Mogball commented on issue #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473#issuecomment-330965324 @mistercrunch The travis CI building doesn't seem to be running on this PR This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3478: Feature: option to disable dashboard refresh staggering
coveralls commented on issue #3478: Feature: option to disable dashboard refresh staggering URL: https://github.com/apache/incubator-superset/pull/3478#issuecomment-331015243 [![Coverage Status](https://coveralls.io/builds/13363648/badge)](https://coveralls.io/builds/13363648) Coverage remained the same at 69.535% when pulling **268804e65f6a6baa43290423cc8208c6179cb7f2 on Mogball:mogball/feature/dashboard_loading** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3478: Feature: option to disable dashboard refresh staggering
coveralls commented on issue #3478: Feature: option to disable dashboard refresh staggering URL: https://github.com/apache/incubator-superset/pull/3478#issuecomment-331015245 [![Coverage Status](https://coveralls.io/builds/13363648/badge)](https://coveralls.io/builds/13363648) Coverage remained the same at 69.535% when pulling **268804e65f6a6baa43290423cc8208c6179cb7f2 on Mogball:mogball/feature/dashboard_loading** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3478: Feature: option to disable dashboard refresh staggering
coveralls commented on issue #3478: Feature: option to disable dashboard refresh staggering URL: https://github.com/apache/incubator-superset/pull/3478#issuecomment-331014915 [![Coverage Status](https://coveralls.io/builds/13363639/badge)](https://coveralls.io/builds/13363639) Coverage remained the same at 69.535% when pulling **268804e65f6a6baa43290423cc8208c6179cb7f2 on Mogball:mogball/feature/dashboard_loading** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3478: Feature: option to disable dashboard refresh staggering
coveralls commented on issue #3478: Feature: option to disable dashboard refresh staggering URL: https://github.com/apache/incubator-superset/pull/3478#issuecomment-331015241 [![Coverage Status](https://coveralls.io/builds/13363648/badge)](https://coveralls.io/builds/13363648) Coverage remained the same at 69.535% when pulling **268804e65f6a6baa43290423cc8208c6179cb7f2 on Mogball:mogball/feature/dashboard_loading** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball opened a new pull request #3509: Add Table performance improvements
Mogball opened a new pull request #3509: Add Table performance improvements URL: https://github.com/apache/incubator-superset/pull/3509 Reduces the number of database requests issued during "Add Table". Testing on a local environment with the example datasets gave about a 4.5x speed up. - Added more performant "check if table exists" and "get dialect" functions - Removed queries and calls to `session.commit()` from the inside of loops This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3509: Add Table performance improvements
coveralls commented on issue #3509: Add Table performance improvements URL: https://github.com/apache/incubator-superset/pull/3509#issuecomment-331021860 [![Coverage Status](https://coveralls.io/builds/13364143/badge)](https://coveralls.io/builds/13364143) Coverage increased (+0.02%) to 69.558% when pulling **022ca79e98ea289a10dec6cda790a15dd89df8eb on Mogball:mogball/bugfix/add_table** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters
coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508#issuecomment-331020602 [![Coverage Status](https://coveralls.io/builds/13364065/badge)](https://coveralls.io/builds/13364065) Coverage decreased (-0.04%) to 69.5% when pulling **973e2ab370476084717a5d1e2a4fe9e373708739 on Mogball:mogball/feature/dashboard_filter** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball commented on issue #3478: Feature: option to disable dashboard refresh staggering
Mogball commented on issue #3478: Feature: option to disable dashboard refresh staggering URL: https://github.com/apache/incubator-superset/pull/3478#issuecomment-331016916 @mistercrunch Done This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters
coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508#issuecomment-331029293 [![Coverage Status](https://coveralls.io/builds/13364521/badge)](https://coveralls.io/builds/13364521) Coverage decreased (-0.07%) to 69.464% when pulling **0a6779420bb7efaf36d8d1c93ab903d5170e0b56 on Mogball:mogball/feature/dashboard_filter** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters
coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508#issuecomment-331029294 [![Coverage Status](https://coveralls.io/builds/13364521/badge)](https://coveralls.io/builds/13364521) Coverage decreased (-0.07%) to 69.464% when pulling **0a6779420bb7efaf36d8d1c93ab903d5170e0b56 on Mogball:mogball/feature/dashboard_filter** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball opened a new pull request #3508: Feature: Datepicker and time granularity options to dashboard filters
Mogball opened a new pull request #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508 As per https://github.com/apache/incubator-superset/issues/1718 and https://github.com/apache/incubator-superset/issues/183, PR adds the ability to set the Time Column (`granularity_sqla`) and Time Grain (`time_grain_sqla`) filters from a dashboard filter, provided that `Date filters` is enabled upon exploring the `Filter Box`. Also, the standard drop-down menus for `from` and `to` have been replaced with the same datepicker used for `Since` and `Until` for explore control panels. https://user-images.githubusercontent.com/15016832/30673872-089acbf2-9e2b-11e7-8161-c5495f80989a.png;> This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball closed pull request #3508: Feature: Datepicker and time granularity options to dashboard filters
Mogball closed pull request #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball opened a new pull request #3508: Feature: Datepicker and time granularity options to dashboard filters
Mogball opened a new pull request #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508 As per https://github.com/apache/incubator-superset/issues/1718 and https://github.com/apache/incubator-superset/issues/183, PR adds the ability to set the Time Column (`granularity_sqla`) and Time Grain (`time_grain_sqla`) filters from a dashboard filter, provided that `Date filters` is enabled upon exploring the `Filter Box`. Also, the standard drop-down menus for `from` and `to` have been replaced with the same datepicker used for `Since` and `Until` for explore control panels. https://user-images.githubusercontent.com/15016832/30673872-089acbf2-9e2b-11e7-8161-c5495f80989a.png;> This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball closed pull request #3508: Feature: Datepicker and time granularity options to dashboard filters
Mogball closed pull request #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball opened a new pull request #3473: Feature: Paired t-test table visualization
Mogball opened a new pull request #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473 Continuation of https://github.com/apache/incubator-superset/pull/3006 ![Paired t-test GIF](https://media.giphy.com/media/l378yi4Wu6THiu9dC/source.gif) Features - Displays p-values and lift values from Student's t-test between any number of time series - Click a row on the table to select the control value - Multiple selected metrics give one table each - Table columns are sortable - Control row to adjust significance level (default 0.05) and decimal precisions - Displays statistically significant time series to the selected control Differences to #3006 - Does not contain a line graph - Supports multiple metrics - Each group name is display in its own column This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball closed pull request #3473: Feature: Paired t-test table visualization
Mogball closed pull request #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters
coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508#issuecomment-331042853 [![Coverage Status](https://coveralls.io/builds/13365248/badge)](https://coveralls.io/builds/13365248) Coverage increased (+0.08%) to 69.613% when pulling **2ce6514450f5d37f657168fa1ce90824378c9015 on Mogball:mogball/feature/dashboard_filter** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters
coveralls commented on issue #3508: Feature: Datepicker and time granularity options to dashboard filters URL: https://github.com/apache/incubator-superset/pull/3508#issuecomment-331042852 [![Coverage Status](https://coveralls.io/builds/13365248/badge)](https://coveralls.io/builds/13365248) Coverage increased (+0.08%) to 69.613% when pulling **2ce6514450f5d37f657168fa1ce90824378c9015 on Mogball:mogball/feature/dashboard_filter** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball commented on issue #3473: Feature: Paired t-test table visualization
Mogball commented on issue #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473#issuecomment-330965324 @mistercrunch The travis CI building doesn't seem to be running on this PR This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3473: Feature: Paired t-test table visualization
coveralls commented on issue #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473#issuecomment-331030093 [![Coverage Status](https://coveralls.io/builds/13364552/badge)](https://coveralls.io/builds/13364552) Coverage decreased (-0.01%) to 69.523% when pulling **aa77088df6fc26d44cdfd0c4b86c3666b37f457e on Mogball:mogball/feature/paired-ttest-viz** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3473: Feature: Paired t-test table visualization
coveralls commented on issue #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473#issuecomment-331030094 [![Coverage Status](https://coveralls.io/builds/13364552/badge)](https://coveralls.io/builds/13364552) Coverage decreased (-0.01%) to 69.523% when pulling **aa77088df6fc26d44cdfd0c4b86c3666b37f457e on Mogball:mogball/feature/paired-ttest-viz** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball opened a new pull request #3473: Feature: Paired t-test table visualization
Mogball opened a new pull request #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473 Continuation of https://github.com/apache/incubator-superset/pull/3006 ![Paired t-test GIF](https://media.giphy.com/media/l378yi4Wu6THiu9dC/source.gif) Features - Displays p-values and lift values from Student's t-test between any number of time series - Click a row on the table to select the control value - Multiple selected metrics give one table each - Table columns are sortable - Control row to adjust significance level (default 0.05) and decimal precisions - Displays statistically significant time series to the selected control Differences to #3006 - Does not contain a line graph - Supports multiple metrics - Each group name is display in its own column This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] Mogball closed pull request #3473: Feature: Paired t-test table visualization
Mogball closed pull request #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zhaoyongjie commented on issue #3468: master branch Install the dependencies in the local node_modules folder failed
zhaoyongjie commented on issue #3468: master branch Install the dependencies in the local node_modules folder failed URL: https://github.com/apache/incubator-superset/issues/3468#issuecomment-331052851 when changing "react-map-gl": "^2.0.3" is "react-map-gl": "2.0.0" from package.json, the build is fine. I guess is a build issues This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3473: Feature: Paired t-test table visualization
coveralls commented on issue #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473#issuecomment-331047246 [![Coverage Status](https://coveralls.io/builds/13365542/badge)](https://coveralls.io/builds/13365542) Coverage increased (+0.1%) to 69.671% when pulling **aa77088df6fc26d44cdfd0c4b86c3666b37f457e on Mogball:mogball/feature/paired-ttest-viz** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3473: Feature: Paired t-test table visualization
coveralls commented on issue #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473#issuecomment-331047247 [![Coverage Status](https://coveralls.io/builds/13365542/badge)](https://coveralls.io/builds/13365542) Coverage increased (+0.1%) to 69.671% when pulling **aa77088df6fc26d44cdfd0c4b86c3666b37f457e on Mogball:mogball/feature/paired-ttest-viz** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3473: Feature: Paired t-test table visualization
coveralls commented on issue #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473#issuecomment-331047248 [![Coverage Status](https://coveralls.io/builds/13365542/badge)](https://coveralls.io/builds/13365542) Coverage increased (+0.1%) to 69.671% when pulling **aa77088df6fc26d44cdfd0c4b86c3666b37f457e on Mogball:mogball/feature/paired-ttest-viz** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3473: Feature: Paired t-test table visualization
coveralls commented on issue #3473: Feature: Paired t-test table visualization URL: https://github.com/apache/incubator-superset/pull/3473#issuecomment-331047245 [![Coverage Status](https://coveralls.io/builds/13365542/badge)](https://coveralls.io/builds/13365542) Coverage increased (+0.1%) to 69.671% when pulling **aa77088df6fc26d44cdfd0c4b86c3666b37f457e on Mogball:mogball/feature/paired-ttest-viz** into **9af34ba51cdb23a2970e968d0cbdee82778c6799 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] vnnw commented on issue #3271: date type field display error
vnnw commented on issue #3271: date type field display error URL: https://github.com/apache/incubator-superset/issues/3271#issuecomment-331058858 Any progress in fixing this bug? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] mistercrunch commented on a change in pull request #3509: Add Table performance improvements
mistercrunch commented on a change in pull request #3509: Add Table performance improvements URL: https://github.com/apache/incubator-superset/pull/3509#discussion_r140152528 ## File path: superset/models/core.py ## @@ -743,6 +744,16 @@ def get_perm(self): return ( "[{obj.database_name}].(id:{obj.id})").format(obj=self) +def has_table(self, table): +engine = self.get_sqla_engine() +return engine.dialect.has_table( +engine, table.table_name, table.schema or None) + +def get_dialect(self): +sqla_url = url.make_url(self.sqlalchemy_uri_decrypted) +entrypoint = sqla_url._get_entrypoint() Review comment: why not `return self.get_sqla_engine().dialect` ? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] mistercrunch commented on issue #3499: Add metric warning
mistercrunch commented on issue #3499: Add metric warning URL: https://github.com/apache/incubator-superset/pull/3499#issuecomment-331057442 Looks like there's an alembic issue where db migrations need to be merged. To fix you can run `superset db history` to view the 2 heads, and then: `superset db merge {HEAD1_SHA} {HEAD2_SHA}` This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3504: Feature: Display the verbose name for metrics within Timeseries charts and legend.
coveralls commented on issue #3504: Feature: Display the verbose name for metrics within Timeseries charts and legend. URL: https://github.com/apache/incubator-superset/pull/3504#issuecomment-330855346 [![Coverage Status](https://coveralls.io/builds/13353851/badge)](https://coveralls.io/builds/13353851) Coverage increased (+0.03%) to 69.496% when pulling **cd50d2d5428e671653e2a07d1b7bec98540fb19e on tc-dc:fmenges/verbose_names_timeseries** into **1cf634afa2d6c4ee1eede98c33f9fadbfd98 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] xrmx opened a new pull request #3506: setup: bump pandas to 0.20.3
xrmx opened a new pull request #3506: setup: bump pandas to 0.20.3 URL: https://github.com/apache/incubator-superset/pull/3506 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3496: Added button on slice for export D3js graph to png
coveralls commented on issue #3496: Added button on slice for export D3js graph to png URL: https://github.com/apache/incubator-superset/pull/3496#issuecomment-330848178 [![Coverage Status](https://coveralls.io/builds/13353437/badge)](https://coveralls.io/builds/13353437) Coverage increased (+0.006%) to 69.465% when pulling **ec087f6cc91e4c4555f8985943875995c9b5303b on ymatagne:export_slice_to_png** into **ed9f56448f39aab9e9bbb331d008390dd63d9b21 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] coveralls commented on issue #3496: Added button on slice for export D3js graph to png
coveralls commented on issue #3496: Added button on slice for export D3js graph to png URL: https://github.com/apache/incubator-superset/pull/3496#issuecomment-330848179 [![Coverage Status](https://coveralls.io/builds/13353437/badge)](https://coveralls.io/builds/13353437) Coverage increased (+0.006%) to 69.465% when pulling **ec087f6cc91e4c4555f8985943875995c9b5303b on ymatagne:export_slice_to_png** into **ed9f56448f39aab9e9bbb331d008390dd63d9b21 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rhunwicks commented on a change in pull request #3492: PandasConnector
rhunwicks commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139944516 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,705 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" + +def __init__(self, database_name, cache_timeout=None): +self.database_name = database_name +self.cache_timeout = cache_timeout + +def __str__(self): +return self.database_name + + +class PandasColumn(Model, BaseColumn): +""" +ORM object for Pandas columns. + +Each Pandas Datasource can have multiple columns""" + +__tablename__ = 'pandas_columns' + +id = Column(Integer, primary_key=True) +pandas_datasource_id = Column(Integer, ForeignKey('pandas_datasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('columns', cascade='all, delete-orphan'), +foreign_keys=[pandas_datasource_id]) + +@property +def is_num(self): +return self.type and is_numeric_dtype(self.type) + +@property +def is_time(self): +return self.type and is_datetime64_any_dtype(self.type) + +@property +def is_dttm(self): +return self.is_time + +@property +def is_string(self): +return self.type and is_string_dtype(self.type) + +num_types = ( +'DOUBLE', 'FLOAT', 'INT', 'BIGINT', +'LONG', 'REAL', 'NUMERIC', 'DECIMAL' +) +date_types = ('DATE', 'TIME', 'DATETIME') +str_types = ('VARCHAR', 'STRING', 'CHAR') + +@property +def expression(self): +return '' + +@property +def data(self): +attrs = ( +'column_name', 'verbose_name', 'description', 'expression', +'filterable', 'groupby') +return {s: getattr(self, s) for s in attrs} + + +class PandasMetric(Model, BaseMetric): +""" +ORM object for Pandas metrics. + +Each Pandas Datasource can have multiple metrics +""" + +__tablename__ = 'pandas_metrics' + +id = Column(Integer, primary_key=True) +pandas_datasource_id = Column(Integer, ForeignKey('pandas_datasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('metrics', cascade='all, delete-orphan'), +foreign_keys=[pandas_datasource_id]) +source = Column(Text) +expression = Column(Text) + +@property +def perm(self): +if self.datasource: +return ('{parent_name}.[{obj.metric_name}]' +'(id:{obj.id})').format( +obj=self, +parent_name=self.datasource.full_name) +return None + + +class PandasDatasource(Model, BaseDatasource): +"""A datasource based on a Pandas DataFrame""" + +FORMATS = [ +('csv', 'CSV'), +('html', 'HTML') +] + +# See http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases # NOQA +GRAINS = OrderedDict([ +('5 seconds', '5S'), +('30 seconds', '30S'), +('1 minute', 'T'), +('5 minutes', '5T'), +('1 hour', 'H'), +('6 hour', '6H'), +('day', 'D'), +('one day', 'D'), +('1 day', 'D'), +('7 days', '7D'), +('week', 'W-MON'), +('week_starting_sunday', 'W-SUN'), +('week_ending_saturday', 'W-SUN'), +('month', 'M'), +('quarter', 'Q'), +('year', 'A'), +]) + +__tablename__ = 'pandas_datasources' +type = 'pandas' +baselink = 'pandasdatasourcemodelview' # url portion pointing to ModelView endpoint +column_class = PandasColumn +metric_class = PandasMetric + +name = Column(String(100), nullable=False) +source_url = Column(String(1000), nullable=False) +format = Column(String(20), nullable=False) +additional_parameters = Column(JSONType) + +user_id = Column(Integer, ForeignKey('ab_user.id')) +owner = relationship( +sm.user_model, +backref='pandas_datasources', +
[GitHub] rhunwicks commented on a change in pull request #3492: PandasConnector
rhunwicks commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139931452 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,724 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" +database_name = '' + +cache_timeout = None + +def __init__(self, database_name, cache_timeout): +self.database_name = database_name +self.cache_timeout = cache_timeout + +def __str__(self): +return self.database_name + + +class PandasColumn(Model, BaseColumn): +""" +ORM object for Pandas columns. + +Each Pandas Datasource can have multiple columns""" + +__tablename__ = 'pandascolumns' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('columns', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) + +@property +def is_num(self): +return self.type and is_numeric_dtype(self.type) + +@property +def is_time(self): +return self.type and is_datetime64_any_dtype(self.type) + +@property +def is_dttm(self): +return self.is_time + +@property +def is_string(self): +return self.type and is_string_dtype(self.type) + +num_types = ( +'DOUBLE', 'FLOAT', 'INT', 'BIGINT', +'LONG', 'REAL', 'NUMERIC', 'DECIMAL' +) +date_types = ('DATE', 'TIME', 'DATETIME') +str_types = ('VARCHAR', 'STRING', 'CHAR') + +@property +def expression(self): +return '' + +@property +def data(self): +attrs = ( +'column_name', 'verbose_name', 'description', 'expression', +'filterable', 'groupby') +return {s: getattr(self, s) for s in attrs} + + +class PandasMetric(Model, BaseMetric): +""" +ORM object for Pandas metrics. + +Each Pandas Datasource can have multiple metrics +""" + +__tablename__ = 'pandasmetrics' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('metrics', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) +source = Column(Text) +expression = Column(Text) + +@property +def perm(self): +if self.datasource: +return ('{parent_name}.[{obj.metric_name}]' +'(id:{obj.id})').format( +obj=self, +parent_name=self.datasource.full_name) +return None + + +class PandasDatasource(Model, BaseDatasource): +"""A datasource based on a Pandas DataFrame""" + +FORMATS = [ +('csv', 'CSV'), +('html', 'HTML') +] + +# See http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases # NOQA +GRAINS = OrderedDict([ +('5 seconds', '5S'), +('30 seconds', '30S'), +('1 minute', 'T'), +('5 minutes', '5T'), +('1 hour', 'H'), +('6 hour', '6H'), +('day', 'D'), +('one day', 'D'), +('1 day', 'D'), +('7 days', '7D'), +('week', 'W-MON'), +('week_starting_sunday', 'W-SUN'), +('week_ending_saturday', 'W-SUN'), +('month', 'M'), +('quarter', 'Q'), +('year', 'A'), +]) + +__tablename__ = 'pandasdatasources' +type = 'pandas' +baselink = 'pandasdatasourcemodelview' # url portion pointing to ModelView endpoint +column_class = PandasColumn +metric_class = PandasMetric + +name = Column(String(100), nullable=False) +source_url = Column(String(1000), nullable=False) +format = Column(String(20), nullable=False) +additional_parameters = Column(JSONType) + +user_id = Column(Integer, ForeignKey('ab_user.id')) +owner = relationship( +sm.user_model, +
[GitHub] rhunwicks commented on a change in pull request #3492: PandasConnector
rhunwicks commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139931531 ## File path: contrib/connectors/pandas/models.py ## @@ -0,0 +1,724 @@ +from collections import OrderedDict +from datetime import datetime +import logging +from past.builtins import basestring +try: +from urllib.parse import urlparse +except ImportError: +from urlparse import urlparse + +import pandas as pd +from pandas.api.types import ( +is_string_dtype, is_numeric_dtype, is_datetime64_any_dtype) + +from sqlalchemy import ( +Column, Integer, String, ForeignKey, Text +) +import sqlalchemy as sa +from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import ChoiceType, JSONType + +from flask import escape, Markup +from flask_appbuilder import Model +from flask_babel import lazy_gettext as _ + +from superset import db, utils, sm +from superset.connectors.base.models import ( +BaseDatasource, BaseColumn, BaseMetric) +from superset.models.helpers import QueryResult, set_perm +from superset.utils import QueryStatus + + +class PandasDatabase(object): +"""Non-ORM object for a Pandas Source""" +database_name = '' + +cache_timeout = None + +def __init__(self, database_name, cache_timeout): +self.database_name = database_name +self.cache_timeout = cache_timeout + +def __str__(self): +return self.database_name + + +class PandasColumn(Model, BaseColumn): +""" +ORM object for Pandas columns. + +Each Pandas Datasource can have multiple columns""" + +__tablename__ = 'pandascolumns' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('columns', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) + +@property +def is_num(self): +return self.type and is_numeric_dtype(self.type) + +@property +def is_time(self): +return self.type and is_datetime64_any_dtype(self.type) + +@property +def is_dttm(self): +return self.is_time + +@property +def is_string(self): +return self.type and is_string_dtype(self.type) + +num_types = ( +'DOUBLE', 'FLOAT', 'INT', 'BIGINT', +'LONG', 'REAL', 'NUMERIC', 'DECIMAL' +) +date_types = ('DATE', 'TIME', 'DATETIME') +str_types = ('VARCHAR', 'STRING', 'CHAR') + +@property +def expression(self): +return '' + +@property +def data(self): +attrs = ( +'column_name', 'verbose_name', 'description', 'expression', +'filterable', 'groupby') +return {s: getattr(self, s) for s in attrs} + + +class PandasMetric(Model, BaseMetric): +""" +ORM object for Pandas metrics. + +Each Pandas Datasource can have multiple metrics +""" + +__tablename__ = 'pandasmetrics' + +id = Column(Integer, primary_key=True) +pandasdatasource_id = Column(Integer, ForeignKey('pandasdatasources.id')) +datasource = relationship( +'PandasDatasource', +backref=backref('metrics', cascade='all, delete-orphan'), +foreign_keys=[pandasdatasource_id]) +source = Column(Text) +expression = Column(Text) + +@property +def perm(self): +if self.datasource: +return ('{parent_name}.[{obj.metric_name}]' +'(id:{obj.id})').format( +obj=self, +parent_name=self.datasource.full_name) +return None + + +class PandasDatasource(Model, BaseDatasource): +"""A datasource based on a Pandas DataFrame""" + +FORMATS = [ +('csv', 'CSV'), +('html', 'HTML') +] + +# See http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases # NOQA +GRAINS = OrderedDict([ +('5 seconds', '5S'), +('30 seconds', '30S'), +('1 minute', 'T'), +('5 minutes', '5T'), +('1 hour', 'H'), +('6 hour', '6H'), +('day', 'D'), +('one day', 'D'), +('1 day', 'D'), +('7 days', '7D'), +('week', 'W-MON'), +('week_starting_sunday', 'W-SUN'), +('week_ending_saturday', 'W-SUN'), +('month', 'M'), +('quarter', 'Q'), +('year', 'A'), +]) + +__tablename__ = 'pandasdatasources' +type = 'pandas' +baselink = 'pandasdatasourcemodelview' # url portion pointing to ModelView endpoint +column_class = PandasColumn +metric_class = PandasMetric + +name = Column(String(100), nullable=False) +source_url = Column(String(1000), nullable=False) +format = Column(String(20), nullable=False) +additional_parameters = Column(JSONType) + +user_id = Column(Integer, ForeignKey('ab_user.id')) +owner = relationship( +sm.user_model, +
[GitHub] rhunwicks commented on a change in pull request #3492: PandasConnector
rhunwicks commented on a change in pull request #3492: PandasConnector URL: https://github.com/apache/incubator-superset/pull/3492#discussion_r139937218 ## File path: contrib/connectors/pandas/views.py ## @@ -0,0 +1,270 @@ +"""Views used by the SqlAlchemy connector""" +import logging + +from past.builtins import basestring + +from flask import Markup, flash, redirect +from flask_appbuilder import CompactCRUDMixin, expose +from flask_appbuilder.models.sqla.interface import SQLAInterface +import sqlalchemy as sa + +from flask_babel import lazy_gettext as _ +from flask_babel import gettext as __ + +from superset import appbuilder, db, utils, security, sm +from superset.utils import has_access +from superset.connectors.base.views import DatasourceModelView +from superset.views.base import ( +SupersetModelView, ListWidgetWithCheckboxes, DeleteMixin, DatasourceFilter, +get_datasource_exist_error_mgs, +) + +from . import models + + +class PandasColumnInlineView(CompactCRUDMixin, SupersetModelView): # noqa +datamodel = SQLAInterface(models.PandasColumn) + +list_title = _('List Columns') +show_title = _('Show Column') +add_title = _('Add Column') +edit_title = _('Edit Column') + +can_delete = False +list_widget = ListWidgetWithCheckboxes +edit_columns = [ +'column_name', 'verbose_name', 'description', +'type', 'groupby', 'filterable', +'datasource', 'count_distinct', 'sum', 'min', 'max'] +add_columns = edit_columns +list_columns = [ +'column_name', 'verbose_name', 'type', 'groupby', 'filterable', +'count_distinct', 'sum', 'min', 'max'] +page_size = 500 +description_columns = { +'is_dttm': _( +"Whether to make this column available as a " +"[Time Granularity] option, column has to be DATETIME or " +"DATETIME-like"), +'filterable': _( +"Whether this column is exposed in the `Filters` section " +"of the explore view."), +'type': _( +"The data type that was inferred by Pandas. " +"It may be necessary to input a type manually for " +"expression-defined columns in some cases. In most case " +"users should not need to alter this."), +} +label_columns = { +'column_name': _("Column"), +'verbose_name': _("Verbose Name"), +'description': _("Description"), +'groupby': _("Groupable"), +'filterable': _("Filterable"), +'datasource': _("Datasource"), +'count_distinct': _("Count Distinct"), +'sum': _("Sum"), +'min': _("Min"), +'max': _("Max"), +'type': _('Type'), +} + + +appbuilder.add_view_no_menu(PandasColumnInlineView) + + +class PandasMetricInlineView(CompactCRUDMixin, SupersetModelView): # noqa +datamodel = SQLAInterface(models.PandasMetric) + +list_title = _('List Metrics') +show_title = _('Show Metric') +add_title = _('Add Metric') +edit_title = _('Edit Metric') + +list_columns = ['metric_name', 'verbose_name', 'metric_type'] +edit_columns = [ +'metric_name', 'description', 'verbose_name', 'metric_type', +'source', 'expression', 'datasource', 'd3format', 'is_restricted'] +description_columns = { +'source': utils.markdown( +"a comma-separated list of column(s) used to calculate " +" the metric. Example: `claim_amount`", True), +'expression': utils.markdown( +"a valid Pandas expression as supported by the underlying " +"backend. Example: `count()`", True), +'is_restricted': _("Whether the access to this metric is restricted " + "to certain roles. Only roles with the permission " + "'metric access on XXX (the name of this metric)' " + "are allowed to access this metric"), +'d3format': utils.markdown( +"d3 formatting string as defined [here]" +"(https://github.com/d3/d3-format/blob/master/README.md#format). " +"For instance, this default formatting applies in the Table " +"visualization and allow for different metric to use different " +"formats", True +), +} +add_columns = edit_columns +page_size = 500 +label_columns = { +'metric_name': _("Metric"), +'description': _("Description"), +'verbose_name': _("Verbose Name"), +'metric_type': _("Type"), +'source': _("Pandas Source Columns"), +'expression': _("Pandas Expression"), +'datasource': _("Datasource"), +'d3format': _("D3 Format"), +'is_restricted': _('Is Restricted') +} + +def post_add(self, metric): +if metric.is_restricted: +security.merge_perm(sm, 'metric_access', metric.get_perm()) + +def post_update(self, metric): +if