Skip to content

Commit

Permalink
Separate data log and metadata creation
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-dbx committed Dec 16, 2021
1 parent 1c2c524 commit e5b521e
Show file tree
Hide file tree
Showing 41 changed files with 185 additions and 119 deletions.
3 changes: 2 additions & 1 deletion tests/integration_tests/base_api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# isort:skip_file
import json
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)

import pytest
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/cache_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from superset.common.db_query_status import QueryStatus
from superset.extensions import cache_manager
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)

from .base_tests import SupersetTestCase
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/celery_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
import unittest.mock as mock
from typing import Optional
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)

import pytest
Expand Down
12 changes: 8 additions & 4 deletions tests/integration_tests/charts/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
from tests.integration_tests.base_api_tests import ApiOwnersTestCaseMixin
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_with_slice,
load_energy_table_data,
)
from tests.integration_tests.fixtures.importexport import (
chart_config,
Expand All @@ -52,10 +54,12 @@
dataset_metadata_config,
)
from tests.integration_tests.fixtures.unicode_dashboard import (
load_unicode_dashboard_with_slice, load_unicode_data
load_unicode_dashboard_with_slice,
load_unicode_data,
)
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)
from tests.integration_tests.insert_chart_mixin import InsertChartMixin
from tests.integration_tests.test_app import app
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/charts/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from superset.models.slice import Slice
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_data,
load_energy_table_with_slice,
)
from tests.integration_tests.fixtures.importexport import (
chart_config,
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/charts/data/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
)
from tests.integration_tests.annotation_layers.fixtures import create_annotation_layers
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.test_app import app

Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/charts/schema_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
from superset.charts.schemas import ChartDataQueryContextSchema
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.query_context import get_query_context

Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/cli_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import superset.cli
from superset import app
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)

logger = logging.getLogger(__name__)
Expand Down
9 changes: 6 additions & 3 deletions tests/integration_tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
from typing import Dict, List
from urllib.parse import quote
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)

import pytest
Expand All @@ -43,7 +44,8 @@
from superset.utils.core import get_example_database
from tests.integration_tests.conftest import with_feature_flags
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_with_slice,
load_energy_table_data,
)
from tests.integration_tests.test_app import app
import superset.views.utils
Expand Down Expand Up @@ -72,7 +74,8 @@

from .base_tests import SupersetTestCase
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)

logger = logging.getLogger(__name__)
Expand Down
10 changes: 7 additions & 3 deletions tests/integration_tests/dashboard_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@
from superset.models.dashboard import Dashboard
from superset.models.slice import Slice
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_with_slice,
load_energy_table_data,
)
from tests.integration_tests.fixtures.public_role import public_role_like_gamma
from tests.integration_tests.fixtures.unicode_dashboard import (
load_unicode_dashboard_with_position,
load_unicode_data,
)
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)

from .base_tests import SupersetTestCase
Expand Down
15 changes: 1 addition & 14 deletions tests/integration_tests/dashboard_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,15 @@ def get_table(
)


def create_table_for_dashboard(
df: DataFrame,
def create_table_metadata(
table_name: str,
database: Database,
dtype: Dict[str, Any],
table_description: str = "",
fetch_values_predicate: Optional[str] = None,
schema: Optional[str] = None,
) -> SqlaTable:
schema = schema or get_example_default_schema()

df.to_sql(
table_name,
database.get_sqla_engine(),
if_exists="replace",
chunksize=500,
dtype=dtype,
index=False,
method="multi",
schema=schema,
)

table = get_table(table_name, database, schema)
if not table:
table_source = ConnectorRegistry.sources["table"]
Expand Down
6 changes: 4 additions & 2 deletions tests/integration_tests/dashboards/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@
)
from tests.integration_tests.utils.get_dashboards import get_dashboards_ids
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)

DASHBOARDS_FIXTURE_COUNT = 10
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/dashboards/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
dataset_metadata_config,
)
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)


Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/dashboards/dao_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from superset.models.dashboard import Dashboard
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)


Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/dashboards/filter_state/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
from superset.models.dashboard import Dashboard
from tests.integration_tests.base_tests import login
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)
from tests.integration_tests.test_app import app

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from tests.integration_tests.dashboards.dashboard_test_utils import *
from tests.integration_tests.dashboards.superset_factory_util import *
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_data,
load_energy_table_with_slice,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
create_slice_to_db,
)
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.public_role import public_role_like_gamma
from tests.integration_tests.fixtures.query_context import get_query_context
Expand Down
10 changes: 7 additions & 3 deletions tests/integration_tests/databases/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@
from superset.utils.core import get_example_database, get_main_database
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.certificates import ssl_certificate
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_with_slice,
load_energy_table_data,
)
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)
from tests.integration_tests.fixtures.importexport import (
database_config,
Expand All @@ -63,6 +66,7 @@
)
from tests.integration_tests.fixtures.unicode_dashboard import (
load_unicode_dashboard_with_position,
load_unicode_data,
)
from tests.integration_tests.test_app import app

Expand Down
6 changes: 4 additions & 2 deletions tests/integration_tests/databases/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
from superset.utils.core import backend, get_example_database
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_data,
load_energy_table_with_slice,
)
from tests.integration_tests.fixtures.importexport import (
database_config,
Expand Down
6 changes: 4 additions & 2 deletions tests/integration_tests/datasets/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.conftest import CTAS_SCHEMA_NAME
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_data,
load_energy_table_with_slice,
)
from tests.integration_tests.fixtures.importexport import (
database_config,
Expand Down
6 changes: 4 additions & 2 deletions tests/integration_tests/datasets/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
from superset.utils.core import get_example_database, get_example_default_schema
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.energy_dashboard import (
load_energy_table_with_slice, load_energy_table_data
load_energy_table_data,
load_energy_table_with_slice,
)
from tests.integration_tests.fixtures.importexport import (
database_config,
Expand All @@ -44,7 +45,8 @@
dataset_ui_export,
)
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices, load_world_bank_data
load_world_bank_dashboard_with_slices,
load_world_bank_data,
)


Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/datasource_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
from superset.utils.core import get_example_database, get_example_default_schema
from tests.integration_tests.base_tests import db_insert_temp_object, SupersetTestCase
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from tests.integration_tests.fixtures.datasource import get_datasource_post

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@
from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec
from tests.integration_tests.test_app import app

from ..fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices
from ..fixtures.energy_dashboard import load_energy_table_with_slice
from ..fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)
from ..fixtures.energy_dashboard import (
load_energy_table_data,
load_energy_table_with_slice,
)
from ..fixtures.pyodbcRow import Row


Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/db_engine_specs/bigquery_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from superset.sql_parse import Table
from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, load_birth_names_data
load_birth_names_dashboard_with_slices,
load_birth_names_data,
)


Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/fixtures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
load_birth_names_dashboard_with_slices,
load_birth_names_dashboard_with_slices_module_scope,
)
from .energy_dashboard import load_energy_table_with_slice, load_energy_table_data
from .energy_dashboard import load_energy_table_data, load_energy_table_with_slice
from .public_role import public_role_like_gamma, public_role_like_test_role
from .unicode_dashboard import (
load_unicode_dashboard_with_position,
Expand Down
Loading

0 comments on commit e5b521e

Please sign in to comment.