2018-08-06 18:30:13 -04:00
|
|
|
"""Fixtures for test_datasource.py"""
|
|
|
|
datasource_post = {
|
|
|
|
'id': None,
|
|
|
|
'column_formats': {'ratio': '.2%'},
|
|
|
|
'description': 'Adding a DESCRip',
|
|
|
|
'default_endpoint': '',
|
2018-08-26 20:14:15 -04:00
|
|
|
'filter_select_enabled': True,
|
2018-08-06 18:30:13 -04:00
|
|
|
'name': 'birth_names',
|
|
|
|
'datasource_name': 'birth_names',
|
|
|
|
'type': 'table',
|
|
|
|
'schema': '',
|
|
|
|
'offset': 66,
|
|
|
|
'cache_timeout': 55,
|
|
|
|
'sql': '',
|
|
|
|
'columns': [
|
|
|
|
{
|
|
|
|
'id': 504,
|
|
|
|
'column_name': 'ds',
|
|
|
|
'verbose_name': '',
|
|
|
|
'description': None,
|
|
|
|
'expression': '',
|
|
|
|
'filterable': True,
|
|
|
|
'groupby': True,
|
|
|
|
'is_dttm': True,
|
|
|
|
'type': 'DATETIME',
|
|
|
|
'database_expression': '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 505,
|
|
|
|
'column_name': 'gender',
|
|
|
|
'verbose_name': None,
|
|
|
|
'description': None,
|
|
|
|
'expression': '',
|
|
|
|
'filterable': True,
|
|
|
|
'groupby': True,
|
|
|
|
'is_dttm': False,
|
|
|
|
'type': 'VARCHAR(16)',
|
|
|
|
'database_expression': None,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 506,
|
|
|
|
'column_name': 'name',
|
|
|
|
'verbose_name': None,
|
|
|
|
'description': None,
|
|
|
|
'expression': None,
|
|
|
|
'filterable': True,
|
|
|
|
'groupby': True,
|
|
|
|
'is_dttm': None,
|
|
|
|
'type': 'VARCHAR(255)',
|
|
|
|
'database_expression': None,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 508,
|
|
|
|
'column_name': 'state',
|
|
|
|
'verbose_name': None,
|
|
|
|
'description': None,
|
|
|
|
'expression': None,
|
|
|
|
'filterable': True,
|
|
|
|
'groupby': True,
|
|
|
|
'is_dttm': None,
|
|
|
|
'type': 'VARCHAR(10)',
|
|
|
|
'database_expression': None,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 509,
|
|
|
|
'column_name': 'sum_boys',
|
|
|
|
'verbose_name': None,
|
|
|
|
'description': None,
|
|
|
|
'expression': None,
|
|
|
|
'filterable': True,
|
|
|
|
'groupby': True,
|
|
|
|
'is_dttm': None,
|
|
|
|
'type': 'BIGINT(20)',
|
|
|
|
'database_expression': None,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 510,
|
|
|
|
'column_name': 'sum_girls',
|
|
|
|
'verbose_name': None,
|
|
|
|
'description': None,
|
|
|
|
'expression': '',
|
|
|
|
'filterable': False,
|
|
|
|
'groupby': False,
|
|
|
|
'is_dttm': False,
|
|
|
|
'type': 'BIGINT(20)',
|
|
|
|
'database_expression': None,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 532,
|
|
|
|
'column_name': 'num',
|
|
|
|
'verbose_name': None,
|
|
|
|
'description': None,
|
|
|
|
'expression': None,
|
|
|
|
'filterable': True,
|
|
|
|
'groupby': True,
|
|
|
|
'is_dttm': None,
|
|
|
|
'type': 'BIGINT(20)',
|
|
|
|
'database_expression': None,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 522,
|
|
|
|
'column_name': 'num_california',
|
|
|
|
'verbose_name': None,
|
|
|
|
'description': None,
|
|
|
|
'expression': "CASE WHEN state = 'CA' THEN num ELSE 0 END",
|
|
|
|
'filterable': False,
|
|
|
|
'groupby': False,
|
|
|
|
'is_dttm': False,
|
|
|
|
'type': 'NUMBER',
|
|
|
|
'database_expression': None,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'metrics': [
|
|
|
|
{
|
|
|
|
'id': 824,
|
|
|
|
'metric_name': 'sum__num',
|
|
|
|
'verbose_name': 'Babies',
|
|
|
|
'description': '',
|
|
|
|
'expression': 'SUM(num)',
|
|
|
|
'warning_text': '',
|
|
|
|
'd3format': '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 836,
|
|
|
|
'metric_name': 'count',
|
|
|
|
'verbose_name': '',
|
|
|
|
'description': None,
|
|
|
|
'expression': 'count(1)',
|
|
|
|
'warning_text': None,
|
|
|
|
'd3format': None,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id': 843,
|
|
|
|
'metric_name': 'ratio',
|
|
|
|
'verbose_name': 'Ratio Boys/Girls',
|
|
|
|
'description': 'This represents the ratio of boys/girls',
|
|
|
|
'expression': 'sum(sum_boys) / sum(sum_girls)',
|
|
|
|
'warning_text': 'no warning',
|
|
|
|
'd3format': '.2%',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|