Improve examples & related tests (#7773)

* [WiP] improve load_examples

related to #7472, longer term we will generate the examples by exporting
them into tarball as in #7472. In the meantime, we need this subset of
the features:

* allowing specifying an alternate database connection for examples
* allowing a --only-metadata flag to `load_examples` to load only
  dashboard and chart definitions, no actual data is loaded

* Improve logging

* Rename data->examples

* Load only if not exist

* By default do not load, add a force flag

* fix build

* set published to true
This commit is contained in:
Maxime Beauchemin
2019-07-16 21:36:56 -07:00
committed by GitHub
parent 86fdceb236
commit d65b039219
45 changed files with 580 additions and 488 deletions

View File

@@ -39,6 +39,7 @@ from superset.db_engine_specs.pinot import PinotEngineSpec
from superset.db_engine_specs.postgres import PostgresEngineSpec
from superset.db_engine_specs.presto import PrestoEngineSpec
from superset.models.core import Database
from superset.utils.core import get_example_database
from .base_tests import SupersetTestCase
@@ -925,14 +926,14 @@ class DbEngineSpecsTestCase(SupersetTestCase):
) # noqa
def test_column_datatype_to_string(self):
main_db = self.get_main_database()
sqla_table = main_db.get_table("energy_usage")
dialect = main_db.get_dialect()
example_db = get_example_database()
sqla_table = example_db.get_table("energy_usage")
dialect = example_db.get_dialect()
col_names = [
main_db.db_engine_spec.column_datatype_to_string(c.type, dialect)
example_db.db_engine_spec.column_datatype_to_string(c.type, dialect)
for c in sqla_table.columns
]
if main_db.backend == "postgresql":
if example_db.backend == "postgresql":
expected = ["VARCHAR(255)", "VARCHAR(255)", "DOUBLE PRECISION"]
else:
expected = ["VARCHAR(255)", "VARCHAR(255)", "FLOAT"]