hy144328 commented on code in PR #41979:
URL: https://github.com/apache/superset/pull/41979#discussion_r3566810207
##########
tests/unit_tests/extensions/test_sqlalchemy.py:
##########
@@ -137,9 +141,9 @@ def test_superset(mocker: MockerFixture, app_context: None,
table1: None) -> Non
# Skip test if superset:// dialect can't be loaded (common in Docker)
pytest.skip(f"Superset dialect not available: {e}")
- conn = engine.connect()
- results = conn.execute(text('SELECT * FROM "database1.table1"'))
- assert list(results) == [(1, 10), (2, 20)]
+ with engine.connect() as conn:
+ results = conn.execute(text('SELECT * FROM "database1.table1"'))
Review Comment:
Nice to have but not a regression to the status quo.
##########
superset/extensions/metadb.py:
##########
@@ -445,15 +445,16 @@ def insert_row(self, row: Row) -> int:
query = self._table.insert().values(**row)
with self.engine_context() as engine:
- connection = engine.connect()
- result = connection.execute(query)
+ with engine.begin() as connection:
+ result = connection.execute(query)
Review Comment:
Nice to have but not a regression to the status quo.
--
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]