MCPcopy
hub / github.com/apache/superset / setup_csv_upload

Function setup_csv_upload

tests/integration_tests/csv_upload_tests.py:60–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58
59@pytest.fixture(scope="module")
60def setup_csv_upload():
61 with app.app_context():
62 login(test_client, username="admin")
63
64 upload_db = utils.get_or_create_db(
65 CSV_UPLOAD_DATABASE, app.config["SQLALCHEMY_EXAMPLES_URI"]
66 )
67 extra = upload_db.get_extra()
68 extra["explore_database_id"] = utils.get_example_database().id
69 upload_db.extra = json.dumps(extra)
70 upload_db.allow_csv_upload = True
71 db.session.commit()
72
73 yield
74
75 upload_db = get_upload_db()
76 engine = upload_db.get_sqla_engine()
77 engine.execute(f"DROP TABLE IF EXISTS {EXCEL_UPLOAD_TABLE}")
78 engine.execute(f"DROP TABLE IF EXISTS {CSV_UPLOAD_TABLE}")
79 engine.execute(f"DROP TABLE IF EXISTS {PARQUET_UPLOAD_TABLE}")
80 engine.execute(f"DROP TABLE IF EXISTS {CSV_UPLOAD_TABLE_W_SCHEMA}")
81 engine.execute(f"DROP TABLE IF EXISTS {CSV_UPLOAD_TABLE_W_EXPLORE}")
82 db.session.delete(upload_db)
83 db.session.commit()
84
85
86@pytest.fixture(scope="module")

Callers

nothing calls this directly

Calls 6

loginFunction · 0.90
get_upload_dbFunction · 0.85
get_extraMethod · 0.80
get_sqla_engineMethod · 0.80
executeMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected