mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
tests: added fixture with energy usage instead of example (#11308)
* Added energy usage fixture. Updated dashboard utils and unicode fixture with new method parameters. * Add energy fixture to tests/access_tests.py * Add energy fixture to tests/core_tests.py * Add energy fixture to tests/dashboard_tests.py * Add energy fixture to tests/datasets/api_tests.py * Add energy fixture to tests/db_engine_specs/base_engine_spec_tests.py * Add energy fixture to tests/import_export_tests.py * Add energy fixture to tests/model_tests.py * Add energy fixture to tests/query_context_tests.py * Add energy fixture to tests/security_tests.py * Add energy fixture to tests/charts/api_tests.py * Changed formatting of slices' parameters in energy usage fixture * Removed loading energy udage data from test conf file * Add energy fixture to tests/databases/api_tests.py * Fixes after review: removed isort:skip, load_charts->load_energy_charts, removed unused import. * Added energy fixture to tests/charts/commands_tests.py and retrieving proper Slice by name * Fixed charts/api_tests.py to use energy_usage from fixtures * Fixed datasets/commands_tests.py to retrieve dataset by name and use energy_usage fixture * Changed energy usage data to generated data and fixed chart tests which was checking energy usage data
This commit is contained in:
@@ -29,7 +29,11 @@ from superset.models.slice import Slice
|
||||
|
||||
|
||||
def create_table_for_dashboard(
|
||||
df: DataFrame, table_name: str, database: Database, dtype: Dict[str, Any]
|
||||
df: DataFrame,
|
||||
table_name: str,
|
||||
database: Database,
|
||||
dtype: Dict[str, Any],
|
||||
table_description: str = "",
|
||||
) -> SqlaTable:
|
||||
df.to_sql(
|
||||
table_name,
|
||||
@@ -48,6 +52,7 @@ def create_table_for_dashboard(
|
||||
if not table:
|
||||
table = table_source(table_name=table_name)
|
||||
table.database = database
|
||||
table.description = table_description
|
||||
db.session.merge(table)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user