zhaoyongjie commented on code in PR #21306:
URL: https://github.com/apache/superset/pull/21306#discussion_r961451735
##########
tests/integration_tests/sqla_models_tests.py:
##########
@@ -453,7 +453,8 @@ def test_fetch_metadata_for_updated_virtual_table(self):
# make sure the columns have been mapped properly
assert len(table.columns) == 4
- table.fetch_metadata(commit=False)
+ with db.session.no_autoflush:
Review Comment:
keep the table in client memory other than writing to DB
##########
tests/integration_tests/sqla_models_tests.py:
##########
@@ -465,15 +466,13 @@ def test_fetch_metadata_for_updated_virtual_table(self):
}
cols: Dict[str, TableColumn] = {col.column_name: col for col in
table.columns}
# assert that the type for intcol has been updated (asserting CI types)
- backend = get_example_database().backend
+ backend = table.database.backend
assert VIRTUAL_TABLE_INT_TYPES[backend].match(cols["intcol"].type)
# assert that the expression has been replaced with the new physical
column
assert cols["mycase"].expression == ""
assert VIRTUAL_TABLE_STRING_TYPES[backend].match(cols["mycase"].type)
assert cols["expr"].expression == "case when 1 then 1 else 0 end"
- db.session.delete(table)
-
Review Comment:
`table` isn't persisted.
--
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]