2019-01-15 18:53:27 -05:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
2018-08-06 18:30:13 -04:00
|
|
|
"""Fixtures for test_datasource.py"""
|
|
|
|
datasource_post = {
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": None,
|
|
|
|
"column_formats": {"ratio": ".2%"},
|
2020-03-10 12:20:37 -04:00
|
|
|
"database": {"id": 1},
|
2019-06-25 16:34:48 -04:00
|
|
|
"description": "Adding a DESCRip",
|
|
|
|
"default_endpoint": "",
|
|
|
|
"filter_select_enabled": True,
|
|
|
|
"name": "birth_names",
|
2020-10-20 12:38:57 -04:00
|
|
|
"table_name": "birth_names",
|
2019-06-25 16:34:48 -04:00
|
|
|
"datasource_name": "birth_names",
|
|
|
|
"type": "table",
|
|
|
|
"schema": "",
|
|
|
|
"offset": 66,
|
|
|
|
"cache_timeout": 55,
|
|
|
|
"sql": "",
|
|
|
|
"columns": [
|
2018-08-06 18:30:13 -04:00
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 504,
|
|
|
|
"column_name": "ds",
|
|
|
|
"verbose_name": "",
|
|
|
|
"description": None,
|
|
|
|
"expression": "",
|
|
|
|
"filterable": True,
|
|
|
|
"groupby": True,
|
|
|
|
"is_dttm": True,
|
|
|
|
"type": "DATETIME",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 505,
|
|
|
|
"column_name": "gender",
|
|
|
|
"verbose_name": None,
|
|
|
|
"description": None,
|
|
|
|
"expression": "",
|
|
|
|
"filterable": True,
|
|
|
|
"groupby": True,
|
|
|
|
"is_dttm": False,
|
|
|
|
"type": "VARCHAR(16)",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 506,
|
|
|
|
"column_name": "name",
|
|
|
|
"verbose_name": None,
|
|
|
|
"description": None,
|
|
|
|
"expression": None,
|
|
|
|
"filterable": True,
|
|
|
|
"groupby": True,
|
|
|
|
"is_dttm": None,
|
|
|
|
"type": "VARCHAR(255)",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 508,
|
|
|
|
"column_name": "state",
|
|
|
|
"verbose_name": None,
|
|
|
|
"description": None,
|
|
|
|
"expression": None,
|
|
|
|
"filterable": True,
|
|
|
|
"groupby": True,
|
|
|
|
"is_dttm": None,
|
|
|
|
"type": "VARCHAR(10)",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 509,
|
2021-01-08 17:13:20 -05:00
|
|
|
"column_name": "num_boys",
|
2019-06-25 16:34:48 -04:00
|
|
|
"verbose_name": None,
|
|
|
|
"description": None,
|
|
|
|
"expression": None,
|
|
|
|
"filterable": True,
|
|
|
|
"groupby": True,
|
|
|
|
"is_dttm": None,
|
|
|
|
"type": "BIGINT(20)",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 510,
|
2021-01-08 17:13:20 -05:00
|
|
|
"column_name": "num_girls",
|
2019-06-25 16:34:48 -04:00
|
|
|
"verbose_name": None,
|
|
|
|
"description": None,
|
|
|
|
"expression": "",
|
|
|
|
"filterable": False,
|
|
|
|
"groupby": False,
|
|
|
|
"is_dttm": False,
|
|
|
|
"type": "BIGINT(20)",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 532,
|
|
|
|
"column_name": "num",
|
|
|
|
"verbose_name": None,
|
|
|
|
"description": None,
|
|
|
|
"expression": None,
|
|
|
|
"filterable": True,
|
|
|
|
"groupby": True,
|
|
|
|
"is_dttm": None,
|
|
|
|
"type": "BIGINT(20)",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"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",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
],
|
2019-06-25 16:34:48 -04:00
|
|
|
"metrics": [
|
2018-08-06 18:30:13 -04:00
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 824,
|
|
|
|
"metric_name": "sum__num",
|
|
|
|
"verbose_name": "Babies",
|
|
|
|
"description": "",
|
|
|
|
"expression": "SUM(num)",
|
|
|
|
"warning_text": "",
|
|
|
|
"d3format": "",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 836,
|
|
|
|
"metric_name": "count",
|
|
|
|
"verbose_name": "",
|
|
|
|
"description": None,
|
|
|
|
"expression": "count(1)",
|
|
|
|
"warning_text": None,
|
|
|
|
"d3format": None,
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
{
|
2019-06-25 16:34:48 -04:00
|
|
|
"id": 843,
|
|
|
|
"metric_name": "ratio",
|
|
|
|
"verbose_name": "Ratio Boys/Girls",
|
|
|
|
"description": "This represents the ratio of boys/girls",
|
2021-01-08 17:13:20 -05:00
|
|
|
"expression": "sum(num_boys) / sum(num_girls)",
|
2019-06-25 16:34:48 -04:00
|
|
|
"warning_text": "no warning",
|
|
|
|
"d3format": ".2%",
|
2018-08-06 18:30:13 -04:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|