mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
feat: migrate examples from Python to YAML format with enhanced CLI
Migrates Superset's example data system from Python-based scripts to YAML configuration files, providing a cleaner, more maintainable approach to managing example datasets, charts, and dashboards. - Converted 9 Python example modules to YAML configurations - Exported existing examples from database and added as YAML files: - 11 dashboards (USA Births Names, World Bank's Data, etc.) - 115 charts - 25 datasets - Moved test-specific fixtures to `tests/fixtures/examples/` - Removed theme_id from dashboard exports for compatibility - **New command group**: `superset examples` with subcommands: - `load` - Load example data (replaces `load-examples`) - `clear-old` - Remove old Python-based examples - `clear` - Placeholder for future YAML clearing - `reload` - Clear and reload in one command - **Backwards compatibility**: `superset load-examples` still works with deprecation warning - **Safety mechanism**: Detects old examples and preserves them to avoid data loss - Fixed JSON data loading - examples can now load `.json.gz` files from CDN - Fixed Docker compose configuration for isolated development - Fixed webpack WebSocket configuration for different ports - Import operations now log what's being created vs updated: - "Creating new dashboard: Sales Dashboard" - "Updating existing chart: World's Population" - Provides clear visibility into the import process - Moved import logging to individual import functions (DRY principle) - Non-destructive migration approach - no user data is deleted - Deterministic UUID generation for consistent example data - Tested migration from old Python examples to new YAML format - Verified safety mechanism prevents accidental data overwrites - Confirmed backwards compatibility with deprecated command - All pre-commit checks pass - Updated installation docs to use new CLI commands - Added deprecation notice to UPDATING.md - Updated development documentation None - the old `load-examples` command continues to work with a deprecation warning. For users with existing Python-based examples: 1. Run `superset examples clear-old --confirm` to remove old examples 2. Run `superset examples load` to load new YAML-based examples
This commit is contained in:
78
tests/fixtures/examples/big_data.py
vendored
Normal file
78
tests/fixtures/examples/big_data.py
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
# 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.
|
||||
import logging
|
||||
import random
|
||||
import string
|
||||
|
||||
import sqlalchemy.sql.sqltypes
|
||||
|
||||
from superset.utils.mock_data import add_data, ColumnInfo
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
COLUMN_TYPES = [
|
||||
sqlalchemy.sql.sqltypes.INTEGER(),
|
||||
sqlalchemy.sql.sqltypes.VARCHAR(length=255),
|
||||
sqlalchemy.sql.sqltypes.TEXT(),
|
||||
sqlalchemy.sql.sqltypes.BOOLEAN(),
|
||||
sqlalchemy.sql.sqltypes.FLOAT(),
|
||||
sqlalchemy.sql.sqltypes.DATE(),
|
||||
sqlalchemy.sql.sqltypes.TIME(),
|
||||
sqlalchemy.sql.sqltypes.TIMESTAMP(),
|
||||
]
|
||||
|
||||
|
||||
def load_big_data() -> None:
|
||||
logger.debug("Creating table `wide_table` with 100 columns")
|
||||
columns: list[ColumnInfo] = []
|
||||
for i in range(100):
|
||||
column: ColumnInfo = {
|
||||
"name": f"col{i}",
|
||||
"type": COLUMN_TYPES[i % len(COLUMN_TYPES)],
|
||||
"nullable": False,
|
||||
"default": None,
|
||||
"autoincrement": "auto",
|
||||
"primary_key": 1 if i == 0 else 0,
|
||||
}
|
||||
columns.append(column)
|
||||
add_data(columns=columns, num_rows=1000, table_name="wide_table")
|
||||
|
||||
logger.debug("Creating 1000 small tables")
|
||||
columns = [
|
||||
{
|
||||
"name": "id",
|
||||
"type": sqlalchemy.sql.sqltypes.INTEGER(),
|
||||
"nullable": False,
|
||||
"default": None,
|
||||
"autoincrement": "auto",
|
||||
"primary_key": 1,
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": sqlalchemy.sql.sqltypes.VARCHAR(length=255),
|
||||
"nullable": False,
|
||||
"default": None,
|
||||
"autoincrement": "auto",
|
||||
"primary_key": 0,
|
||||
},
|
||||
]
|
||||
for i in range(1000):
|
||||
add_data(columns=columns, num_rows=10, table_name=f"small_table_{i}")
|
||||
|
||||
logger.debug("Creating table with long name")
|
||||
name = "".join(random.choices(string.ascii_letters + string.digits, k=60)) # noqa: S311
|
||||
add_data(columns=columns, num_rows=10, table_name=name)
|
||||
146
tests/fixtures/examples/energy.py
vendored
Normal file
146
tests/fixtures/examples/energy.py
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
# 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.
|
||||
import logging
|
||||
import textwrap
|
||||
|
||||
from sqlalchemy import Float, inspect, String
|
||||
from sqlalchemy.sql import column
|
||||
|
||||
import superset.utils.database as database_utils
|
||||
from superset import db
|
||||
from superset.connectors.sqla.models import SqlMetric
|
||||
from superset.examples.helpers import (
|
||||
get_slice_json,
|
||||
get_table_connector_registry,
|
||||
merge_slice,
|
||||
misc_dash_slices,
|
||||
read_example_data,
|
||||
)
|
||||
from superset.models.slice import Slice
|
||||
from superset.sql.parse import Table
|
||||
from superset.utils.core import DatasourceType
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def load_energy(
|
||||
only_metadata: bool = False, force: bool = False, sample: bool = False
|
||||
) -> None:
|
||||
"""Loads an energy related dataset to use with sankey and graphs"""
|
||||
tbl_name = "energy_usage"
|
||||
database = database_utils.get_example_database()
|
||||
|
||||
with database.get_sqla_engine() as engine:
|
||||
schema = inspect(engine).default_schema_name
|
||||
table_exists = database.has_table(Table(tbl_name, schema))
|
||||
|
||||
if not only_metadata and (not table_exists or force):
|
||||
pdf = read_example_data("examples://energy.json.gz", compression="gzip")
|
||||
pdf = pdf.head(100) if sample else pdf
|
||||
pdf.to_sql(
|
||||
tbl_name,
|
||||
engine,
|
||||
schema=schema,
|
||||
if_exists="replace",
|
||||
chunksize=500,
|
||||
dtype={"source": String(255), "target": String(255), "value": Float()},
|
||||
index=False,
|
||||
method="multi",
|
||||
)
|
||||
|
||||
logger.debug("Creating table [wb_health_population] reference")
|
||||
table = get_table_connector_registry()
|
||||
tbl = db.session.query(table).filter_by(table_name=tbl_name).first()
|
||||
if not tbl:
|
||||
tbl = table(table_name=tbl_name, schema=schema)
|
||||
db.session.add(tbl)
|
||||
tbl.description = "Energy consumption"
|
||||
tbl.database = database
|
||||
tbl.filter_select_enabled = True
|
||||
|
||||
if not any(col.metric_name == "sum__value" for col in tbl.metrics):
|
||||
col = str(column("value").compile(db.engine))
|
||||
tbl.metrics.append(
|
||||
SqlMetric(metric_name="sum__value", expression=f"SUM({col})")
|
||||
)
|
||||
|
||||
tbl.fetch_metadata()
|
||||
|
||||
slc = Slice(
|
||||
slice_name="Energy Sankey",
|
||||
viz_type="sankey_v2",
|
||||
datasource_type=DatasourceType.TABLE,
|
||||
datasource_id=tbl.id,
|
||||
params=textwrap.dedent(
|
||||
"""\
|
||||
{
|
||||
"collapsed_fieldsets": "",
|
||||
"source": "source",
|
||||
"target": "target",
|
||||
"metric": "sum__value",
|
||||
"row_limit": "5000",
|
||||
"slice_name": "Energy Sankey",
|
||||
"viz_type": "sankey_v2"
|
||||
}
|
||||
"""
|
||||
),
|
||||
)
|
||||
misc_dash_slices.add(slc.slice_name)
|
||||
merge_slice(slc)
|
||||
|
||||
slc = Slice(
|
||||
slice_name="Energy Force Layout",
|
||||
viz_type="graph_chart",
|
||||
datasource_type=DatasourceType.TABLE,
|
||||
datasource_id=tbl.id,
|
||||
params=textwrap.dedent(
|
||||
"""\
|
||||
{
|
||||
"source": "source",
|
||||
"target": "target",
|
||||
"edgeLength": 400,
|
||||
"repulsion": 1000,
|
||||
"layout": "force",
|
||||
"metric": "sum__value",
|
||||
"row_limit": "5000",
|
||||
"slice_name": "Force",
|
||||
"viz_type": "graph_chart"
|
||||
}
|
||||
"""
|
||||
),
|
||||
)
|
||||
misc_dash_slices.add(slc.slice_name)
|
||||
merge_slice(slc)
|
||||
|
||||
slc = Slice(
|
||||
slice_name="Heatmap",
|
||||
viz_type="heatmap_v2",
|
||||
datasource_type=DatasourceType.TABLE,
|
||||
datasource_id=tbl.id,
|
||||
params=get_slice_json(
|
||||
defaults={},
|
||||
viz_type="heatmap_v2",
|
||||
x_axis="source",
|
||||
groupby="target",
|
||||
legend_type="continuous",
|
||||
metric="sum__value",
|
||||
sort_x_axis="value_asc",
|
||||
sort_y_axis="value_asc",
|
||||
),
|
||||
)
|
||||
misc_dash_slices.add(slc.slice_name)
|
||||
merge_slice(slc)
|
||||
1250
tests/fixtures/examples/supported_charts_dashboard.py
vendored
Normal file
1250
tests/fixtures/examples/supported_charts_dashboard.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
560
tests/fixtures/examples/tabbed_dashboard.py
vendored
Normal file
560
tests/fixtures/examples/tabbed_dashboard.py
vendored
Normal file
@@ -0,0 +1,560 @@
|
||||
# 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.
|
||||
import logging
|
||||
import textwrap
|
||||
|
||||
from superset import db
|
||||
from superset.examples.helpers import update_slice_ids
|
||||
from superset.models.dashboard import Dashboard
|
||||
from superset.utils import json
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def load_tabbed_dashboard(_: bool = False) -> None:
|
||||
"""Creating a tabbed dashboard"""
|
||||
|
||||
logger.debug("Creating a dashboard with nested tabs")
|
||||
slug = "tabbed_dash"
|
||||
dash = db.session.query(Dashboard).filter_by(slug=slug).first()
|
||||
|
||||
if not dash:
|
||||
dash = Dashboard()
|
||||
db.session.add(dash)
|
||||
|
||||
js = textwrap.dedent(
|
||||
"""
|
||||
{
|
||||
"CHART-06Kg-rUggO": {
|
||||
"children": [],
|
||||
"id": "CHART-06Kg-rUggO",
|
||||
"meta": {
|
||||
"chartId": 617,
|
||||
"height": 42,
|
||||
"sliceName": "Number of Girls",
|
||||
"width": 4
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-_o23occSTg",
|
||||
"TABS-CslNeIC6x8",
|
||||
"TAB-SDz1jDqYZ2",
|
||||
"ROW-DnYkJgKQE"
|
||||
],
|
||||
"type": "CHART"
|
||||
},
|
||||
"CHART-E4rQMdzY9-": {
|
||||
"children": [],
|
||||
"id": "CHART-E4rQMdzY9-",
|
||||
"meta": {
|
||||
"chartId": 616,
|
||||
"height": 41,
|
||||
"sliceName": "Names Sorted by Num in California",
|
||||
"width": 4
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-_o23occSTg",
|
||||
"TABS-CslNeIC6x8",
|
||||
"TAB-SDz1jDqYZ2",
|
||||
"ROW-DnYkJgKQE"
|
||||
],
|
||||
"type": "CHART"
|
||||
},
|
||||
"CHART-WO52N6b5de": {
|
||||
"children": [],
|
||||
"id": "CHART-WO52N6b5de",
|
||||
"meta": {
|
||||
"chartId": 615,
|
||||
"height": 41,
|
||||
"sliceName": "Top 10 California Names Timeseries",
|
||||
"width": 8
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-_o23occSTg",
|
||||
"TABS-CslNeIC6x8",
|
||||
"TAB-t54frVKlx",
|
||||
"ROW-ghqEVzr2fA"
|
||||
],
|
||||
"type": "CHART"
|
||||
},
|
||||
"CHART-c0EjR-OZ0n": {
|
||||
"children": [],
|
||||
"id": "CHART-c0EjR-OZ0n",
|
||||
"meta": {
|
||||
"chartId": 598,
|
||||
"height": 50,
|
||||
"sliceName": "Treemap",
|
||||
"width": 4
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-RGd6kjW57J"
|
||||
],
|
||||
"type": "CHART"
|
||||
},
|
||||
"CHART-dxV7Il74hH": {
|
||||
"children": [],
|
||||
"id": "CHART-dxV7Il74hH",
|
||||
"meta": {
|
||||
"chartId": 597,
|
||||
"height": 50,
|
||||
"sliceName": "Box plot",
|
||||
"width": 4
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-gcQJxApOZS",
|
||||
"TABS-afnrUvdxYF",
|
||||
"TAB-jNNd4WWar1",
|
||||
"ROW-7ygtDczaQ"
|
||||
],
|
||||
"type": "CHART"
|
||||
},
|
||||
"CHART-dxV7Il666H": {
|
||||
"children": [],
|
||||
"id": "CHART-dxV7Il666H",
|
||||
"meta": {
|
||||
"chartId": 5539,
|
||||
"height": 50,
|
||||
"sliceName": "Trends",
|
||||
"width": 4
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-gcQJxApOZS",
|
||||
"TABS-afnrUvdxYF",
|
||||
"TAB-jNNd4WWar1",
|
||||
"ROW-7ygtD666Q"
|
||||
],
|
||||
"type": "CHART"
|
||||
},
|
||||
"CHART-jJ5Yj1Ptaz": {
|
||||
"children": [],
|
||||
"id": "CHART-jJ5Yj1Ptaz",
|
||||
"meta": {
|
||||
"chartId": 592,
|
||||
"height": 29,
|
||||
"sliceName": "Growth Rate",
|
||||
"width": 5
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-z81Q87PD7",
|
||||
"ROW-G73z9PIHn"
|
||||
],
|
||||
"type": "CHART"
|
||||
},
|
||||
"CHART-z4gmEuCqQ5": {
|
||||
"children": [],
|
||||
"id": "CHART-z4gmEuCqQ5",
|
||||
"meta": {
|
||||
"chartId": 589,
|
||||
"height": 50,
|
||||
"sliceName": "Region Filter",
|
||||
"width": 4
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-EcNm_wh922",
|
||||
"ROW-LCjsdSetJ"
|
||||
],
|
||||
"type": "CHART"
|
||||
},
|
||||
"COLUMN-RGd6kjW57J": {
|
||||
"children": ["CHART-c0EjR-OZ0n"],
|
||||
"id": "COLUMN-RGd6kjW57J",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT", "width": 4 },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N"
|
||||
],
|
||||
"type": "COLUMN"
|
||||
},
|
||||
"COLUMN-V6vsdWdOEJ": {
|
||||
"children": ["TABS-urzRuDRusW"],
|
||||
"id": "COLUMN-V6vsdWdOEJ",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT", "width": 7 },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-z81Q87PD7",
|
||||
"ROW-G73z9PIHn"
|
||||
],
|
||||
"type": "COLUMN"
|
||||
},
|
||||
"COLUMN-_o23occSTg": {
|
||||
"children": ["TABS-CslNeIC6x8"],
|
||||
"id": "COLUMN-_o23occSTg",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT", "width": 8 },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N"
|
||||
],
|
||||
"type": "COLUMN"
|
||||
},
|
||||
"DASHBOARD_VERSION_KEY": "v2",
|
||||
"GRID_ID": { "children": [], "id": "GRID_ID", "type": "GRID" },
|
||||
"HEADER_ID": {
|
||||
"id": "HEADER_ID",
|
||||
"type": "HEADER",
|
||||
"meta": { "text": "Tabbed Dashboard" }
|
||||
},
|
||||
"ROOT_ID": {
|
||||
"children": ["TABS-lV0r00f4H1"],
|
||||
"id": "ROOT_ID",
|
||||
"type": "ROOT"
|
||||
},
|
||||
"ROW-7ygtDczaQ": {
|
||||
"children": ["CHART-dxV7Il74hH"],
|
||||
"id": "ROW-7ygtDczaQ",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-gcQJxApOZS",
|
||||
"TABS-afnrUvdxYF",
|
||||
"TAB-jNNd4WWar1"
|
||||
],
|
||||
"type": "ROW"
|
||||
},
|
||||
"ROW-7ygtD666Q": {
|
||||
"children": ["CHART-dxV7Il666H"],
|
||||
"id": "ROW-7ygtD666Q",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-gcQJxApOZS",
|
||||
"TABS-afnrUvdxYF",
|
||||
"TAB-jNNd4WWar1"
|
||||
],
|
||||
"type": "ROW"
|
||||
},
|
||||
"ROW-DnYkJgKQE": {
|
||||
"children": ["CHART-06Kg-rUggO", "CHART-E4rQMdzY9-"],
|
||||
"id": "ROW-DnYkJgKQE",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-_o23occSTg",
|
||||
"TABS-CslNeIC6x8",
|
||||
"TAB-SDz1jDqYZ2"
|
||||
],
|
||||
"type": "ROW"
|
||||
},
|
||||
"ROW-G73z9PIHn": {
|
||||
"children": ["CHART-jJ5Yj1Ptaz", "COLUMN-V6vsdWdOEJ"],
|
||||
"id": "ROW-G73z9PIHn",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-z81Q87PD7"
|
||||
],
|
||||
"type": "ROW"
|
||||
},
|
||||
"ROW-LCjsdSetJ": {
|
||||
"children": ["CHART-z4gmEuCqQ5"],
|
||||
"id": "ROW-LCjsdSetJ",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-EcNm_wh922"
|
||||
],
|
||||
"type": "ROW"
|
||||
},
|
||||
"ROW-ghqEVzr2fA": {
|
||||
"children": ["CHART-WO52N6b5de"],
|
||||
"id": "ROW-ghqEVzr2fA",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-_o23occSTg",
|
||||
"TABS-CslNeIC6x8",
|
||||
"TAB-t54frVKlx"
|
||||
],
|
||||
"type": "ROW"
|
||||
},
|
||||
"ROW-kHj58UJg5N": {
|
||||
"children": ["COLUMN-RGd6kjW57J", "COLUMN-_o23occSTg"],
|
||||
"id": "ROW-kHj58UJg5N",
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT" },
|
||||
"parents": ["ROOT_ID", "TABS-lV0r00f4H1", "TAB-NF3dlrWGS"],
|
||||
"type": "ROW"
|
||||
},
|
||||
"TAB-0yhA2SgdPg": {
|
||||
"children": ["ROW-Gr9YPyQGwf"],
|
||||
"id": "TAB-0yhA2SgdPg",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Level 2 nested tab 1"
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-z81Q87PD7",
|
||||
"ROW-G73z9PIHn",
|
||||
"COLUMN-V6vsdWdOEJ",
|
||||
"TABS-urzRuDRusW"
|
||||
],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TAB-3a1Gvm-Ef": {
|
||||
"children": [],
|
||||
"id": "TAB-3a1Gvm-Ef",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Level 2 nested tab 2"
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-z81Q87PD7",
|
||||
"ROW-G73z9PIHn",
|
||||
"COLUMN-V6vsdWdOEJ",
|
||||
"TABS-urzRuDRusW"
|
||||
],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TAB-EcNm_wh922": {
|
||||
"children": ["ROW-LCjsdSetJ"],
|
||||
"id": "TAB-EcNm_wh922",
|
||||
"meta": { "text": "row tab 1" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj"
|
||||
],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TAB-NF3dlrWGS": {
|
||||
"children": ["ROW-kHj58UJg5N", "TABS-CSjo6VfNrj"],
|
||||
"id": "TAB-NF3dlrWGS",
|
||||
"meta": { "text": "Tab A" },
|
||||
"parents": ["ROOT_ID", "TABS-lV0r00f4H1"],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TAB-SDz1jDqYZ2": {
|
||||
"children": ["ROW-DnYkJgKQE"],
|
||||
"id": "TAB-SDz1jDqYZ2",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Nested tab 1"
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-_o23occSTg",
|
||||
"TABS-CslNeIC6x8"
|
||||
],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TAB-gcQJxApOZS": {
|
||||
"children": ["TABS-afnrUvdxYF"],
|
||||
"id": "TAB-gcQJxApOZS",
|
||||
"meta": { "text": "Tab B" },
|
||||
"parents": ["ROOT_ID", "TABS-lV0r00f4H1"],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TAB-jNNd4WWar1": {
|
||||
"children": ["ROW-7ygtDczaQ", "ROW-7ygtD666Q"],
|
||||
"id": "TAB-jNNd4WWar1",
|
||||
"meta": { "text": "New Tab" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-gcQJxApOZS",
|
||||
"TABS-afnrUvdxYF"
|
||||
],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TAB-t54frVKlx": {
|
||||
"children": ["ROW-ghqEVzr2fA"],
|
||||
"id": "TAB-t54frVKlx",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Nested tab 2"
|
||||
},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-_o23occSTg",
|
||||
"TABS-CslNeIC6x8"
|
||||
],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TAB-z81Q87PD7": {
|
||||
"children": ["ROW-G73z9PIHn"],
|
||||
"id": "TAB-z81Q87PD7",
|
||||
"meta": { "text": "row tab 2" },
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj"
|
||||
],
|
||||
"type": "TAB"
|
||||
},
|
||||
"TABS-CSjo6VfNrj": {
|
||||
"children": ["TAB-EcNm_wh922", "TAB-z81Q87PD7"],
|
||||
"id": "TABS-CSjo6VfNrj",
|
||||
"meta": {},
|
||||
"parents": ["ROOT_ID", "TABS-lV0r00f4H1", "TAB-NF3dlrWGS"],
|
||||
"type": "TABS"
|
||||
},
|
||||
"TABS-CslNeIC6x8": {
|
||||
"children": ["TAB-SDz1jDqYZ2", "TAB-t54frVKlx"],
|
||||
"id": "TABS-CslNeIC6x8",
|
||||
"meta": {},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"ROW-kHj58UJg5N",
|
||||
"COLUMN-_o23occSTg"
|
||||
],
|
||||
"type": "TABS"
|
||||
},
|
||||
"TABS-afnrUvdxYF": {
|
||||
"children": ["TAB-jNNd4WWar1"],
|
||||
"id": "TABS-afnrUvdxYF",
|
||||
"meta": {},
|
||||
"parents": ["ROOT_ID", "TABS-lV0r00f4H1", "TAB-gcQJxApOZS"],
|
||||
"type": "TABS"
|
||||
},
|
||||
"TABS-lV0r00f4H1": {
|
||||
"children": ["TAB-NF3dlrWGS", "TAB-gcQJxApOZS"],
|
||||
"id": "TABS-lV0r00f4H1",
|
||||
"meta": {},
|
||||
"parents": ["ROOT_ID"],
|
||||
"type": "TABS"
|
||||
},
|
||||
"TABS-urzRuDRusW": {
|
||||
"children": ["TAB-0yhA2SgdPg", "TAB-3a1Gvm-Ef"],
|
||||
"id": "TABS-urzRuDRusW",
|
||||
"meta": {},
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-z81Q87PD7",
|
||||
"ROW-G73z9PIHn",
|
||||
"COLUMN-V6vsdWdOEJ"
|
||||
],
|
||||
"type": "TABS"
|
||||
},
|
||||
"CHART-p4_VUp8w3w": {
|
||||
"type": "CHART",
|
||||
"id": "CHART-p4_VUp8w3w",
|
||||
"children": [],
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-z81Q87PD7",
|
||||
"ROW-G73z9PIHn",
|
||||
"COLUMN-V6vsdWdOEJ",
|
||||
"TABS-urzRuDRusW",
|
||||
"TAB-0yhA2SgdPg",
|
||||
"ROW-Gr9YPyQGwf"
|
||||
],
|
||||
"meta": {
|
||||
"width": 4,
|
||||
"height": 20,
|
||||
"chartId": 614,
|
||||
"sliceName": "Number of California Births"
|
||||
}
|
||||
},
|
||||
"ROW-Gr9YPyQGwf": {
|
||||
"type": "ROW",
|
||||
"id": "ROW-Gr9YPyQGwf",
|
||||
"children": ["CHART-p4_VUp8w3w"],
|
||||
"parents": [
|
||||
"ROOT_ID",
|
||||
"TABS-lV0r00f4H1",
|
||||
"TAB-NF3dlrWGS",
|
||||
"TABS-CSjo6VfNrj",
|
||||
"TAB-z81Q87PD7",
|
||||
"ROW-G73z9PIHn",
|
||||
"COLUMN-V6vsdWdOEJ",
|
||||
"TABS-urzRuDRusW",
|
||||
"TAB-0yhA2SgdPg"
|
||||
],
|
||||
"meta": { "background": "BACKGROUND_TRANSPARENT" }
|
||||
}
|
||||
}"""
|
||||
)
|
||||
pos = json.loads(js)
|
||||
slices = update_slice_ids(pos)
|
||||
dash.position_json = json.dumps(pos, indent=4)
|
||||
dash.slices = slices
|
||||
dash.dashboard_title = "Tabbed Dashboard"
|
||||
dash.slug = slug
|
||||
Reference in New Issue
Block a user