hy144328 commented on code in PR #41917:
URL: https://github.com/apache/superset/pull/41917#discussion_r3564001716


##########
superset/utils/mock_data.py:
##########
@@ -205,11 +205,12 @@ def add_data(
         table = DBTable(table_name, metadata, *column_objects)
         metadata.create_all(engine)
 
-        if not append:
-            engine.execute(table.delete())
+        with engine.begin() as conn:
+            if not append:
+                conn.execute(table.delete())
 
-        data = generate_data(columns, num_rows)
-        engine.execute(table.insert(), data)
+            data = generate_data(columns, num_rows)

Review Comment:
   Not a regression.



##########
tests/integration_tests/databases/commands/upload_test.py:
##########
@@ -114,12 +115,13 @@ def test_csv_upload_with_nulls():
             CSVReader({"null_values": ["N/A", "None"]}),
         ).run()
     with upload_database.get_sqla_engine() as engine:
-        data = engine.execute(text(f"SELECT * from 
{CSV_UPLOAD_TABLE}")).fetchall()  # noqa: S608
-        assert data == [
-            ("name1", None, "city1", "1-1-1980"),
-            ("name2", 29, None, "1-1-1981"),
-            ("name3", 28, "city3", "1-1-1982"),
-        ]
+        with engine.connect() as conn:
+            data = conn.execute(text(f"SELECT * from 
{CSV_UPLOAD_TABLE}")).fetchall()  # noqa: S608

Review Comment:
   Not a regression.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to