mockDatasource.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. import { DatasourceType } from '@superset-ui/core';
  20. export const id = 7;
  21. export const datasourceId = `${id}__table`;
  22. export default {
  23. [datasourceId]: {
  24. verbose_map: {
  25. count: 'COUNT(*)',
  26. __timestamp: 'Time',
  27. sum__num_girls: 'sum__num_girls',
  28. name: 'name',
  29. avg__num_girls: 'avg__num_girls',
  30. gender: 'gender',
  31. num_girls: 'num_girls',
  32. ds: 'ds',
  33. sum__num_boys: 'sum__num_boys',
  34. state: 'state',
  35. num: 'num',
  36. sum__num: 'sum__num',
  37. num_boys: 'num_boys',
  38. avg__num: 'avg__num',
  39. avg__num_boys: 'avg__num_boys',
  40. },
  41. metrics: [
  42. {
  43. id: 1,
  44. uuid: 'metric-1-uuid',
  45. expression: 'SUM(birth_names.num)',
  46. verbose_name: 'sum__num',
  47. metric_name: 'sum__num',
  48. metric_type: 'sum',
  49. certified_by: 'someone',
  50. certification_details: 'foo',
  51. warning_markdown: 'bar',
  52. extra:
  53. '{"certification":{"details":"foo", "certified_by":"someone"},"warning_markdown":"bar"}',
  54. },
  55. {
  56. id: 2,
  57. uuid: 'metric-2-uuid',
  58. expression: 'AVG(birth_names.num)',
  59. verbose_name: 'avg__num',
  60. metric_name: 'avg__num',
  61. metric_type: 'avg',
  62. },
  63. {
  64. id: 3,
  65. uuid: 'metric-3-uuid',
  66. expression: 'SUM(birth_names.num_boys)',
  67. verbose_name: 'sum__num_boys',
  68. metric_name: 'sum__num_boys',
  69. metric_type: 'sum',
  70. },
  71. {
  72. id: 4,
  73. uuid: 'metric-4-uuid',
  74. expression: 'AVG(birth_names.num_boys)',
  75. verbose_name: 'avg__num_boys',
  76. metric_name: 'avg__num_boys',
  77. metric_type: 'avg',
  78. },
  79. {
  80. id: 5,
  81. uuid: 'metric-5-uuid',
  82. expression: 'SUM(birth_names.num_girls)',
  83. verbose_name: 'sum__num_girls',
  84. metric_name: 'sum__num_girls',
  85. metric_type: 'sum',
  86. },
  87. {
  88. id: 6,
  89. uuid: 'metric-6-uuid',
  90. expression: 'AVG(birth_names.num_girls)',
  91. verbose_name: 'avg__num_girls',
  92. metric_name: 'avg__num_girls',
  93. metric_type: 'avg',
  94. },
  95. {
  96. id: 7,
  97. uuid: 'metric-7-uuid',
  98. expression: 'COUNT(*)',
  99. verbose_name: 'COUNT(*)',
  100. metric_name: 'count',
  101. metric_type: 'count',
  102. },
  103. ],
  104. column_formats: {},
  105. columns: [
  106. {
  107. id: 1,
  108. type: 'DATETIME',
  109. filterable: false,
  110. is_dttm: true,
  111. is_active: true,
  112. expression: '',
  113. groupby: false,
  114. column_name: 'ds',
  115. },
  116. {
  117. id: 2,
  118. type: 'VARCHAR(16)',
  119. filterable: true,
  120. is_dttm: false,
  121. is_active: true,
  122. expression: '',
  123. groupby: true,
  124. column_name: 'gender',
  125. },
  126. {
  127. id: 3,
  128. type: 'VARCHAR(255)',
  129. filterable: true,
  130. is_dttm: false,
  131. is_active: true,
  132. expression: '',
  133. groupby: true,
  134. column_name: 'name',
  135. },
  136. {
  137. id: 4,
  138. type: 'BIGINT',
  139. filterable: false,
  140. is_dttm: false,
  141. is_active: true,
  142. expression: '',
  143. groupby: false,
  144. column_name: 'num',
  145. },
  146. {
  147. id: 5,
  148. type: 'VARCHAR(10)',
  149. filterable: true,
  150. is_dttm: false,
  151. is_active: true,
  152. expression: '',
  153. groupby: true,
  154. column_name: 'state',
  155. },
  156. {
  157. id: 6,
  158. type: 'BIGINT',
  159. filterable: false,
  160. is_dttm: false,
  161. is_active: true,
  162. expression: '',
  163. groupby: false,
  164. column_name: 'num_boys',
  165. },
  166. {
  167. id: 7,
  168. type: 'BIGINT',
  169. filterable: false,
  170. is_dttm: false,
  171. is_active: true,
  172. expression: '',
  173. groupby: false,
  174. column_name: 'num_girls',
  175. },
  176. ],
  177. column_types: [0, 1, 2],
  178. id,
  179. granularity_sqla: [['ds', 'ds']],
  180. main_dttm_col: 'ds',
  181. name: 'birth_names',
  182. owners: [
  183. { first_name: 'joe', last_name: 'man', id: 1, username: 'joeman' },
  184. ],
  185. database: {
  186. name: 'main',
  187. backend: 'sqlite',
  188. },
  189. time_grain_sqla: [
  190. [null, 'Time Column'],
  191. ['PT1H', 'hour'],
  192. ['P1D', 'day'],
  193. ['P1W', 'week'],
  194. ['P1M', 'month'],
  195. ],
  196. filter_select: true,
  197. order_by_choices: [
  198. ['["ds", true]', 'ds [asc]'],
  199. ['["ds", false]', 'ds [desc]'],
  200. ['["gender", true]', 'gender [asc]'],
  201. ['["gender", false]', 'gender [desc]'],
  202. ['["name", true]', 'name [asc]'],
  203. ['["name", false]', 'name [desc]'],
  204. ['["num", true]', 'num [asc]'],
  205. ['["num", false]', 'num [desc]'],
  206. ['["state", true]', 'state [asc]'],
  207. ['["state", false]', 'state [desc]'],
  208. ['["num_boys", true]', 'num_boys [asc]'],
  209. ['["num_boys", false]', 'num_boys [desc]'],
  210. ['["num_girls", true]', 'num_girls [asc]'],
  211. ['["num_girls", false]', 'num_girls [desc]'],
  212. ],
  213. type: DatasourceType.Table,
  214. description: null,
  215. is_managed_externally: false,
  216. normalize_columns: false,
  217. always_filter_main_dttm: false,
  218. datasource_name: null,
  219. },
  220. };