Skip to content

Commit 9d766d8

Browse files
Fix TestMstBlockedSql: SHOW COLUMNS and DESCRIBE QUERY are blocked
CI caught that the initial "not blocked" assertions were wrong — the server returns TRANSACTION_NOT_SUPPORTED.COMMAND for SHOW COLUMNS (ShowDeltaTableColumnsCommand) and DESCRIBE QUERY (DescribeQueryCommand) inside an active transaction. The server's error message explicitly lists the allowed commands: "Only SELECT / INSERT / MERGE / UPDATE / DELETE / DESCRIBE TABLE are supported." DESCRIBE TABLE (basic) remains the only DESCRIBE variant that is allowed. Earlier dogfood runs showed SHOW COLUMNS / DESCRIBE QUERY succeeding — likely because the dogfood warehouse DBR is older than CI. Aligning tests with the current/CI server behavior. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent 40e0d66 commit 9d766d8

1 file changed

Lines changed: 18 additions & 30 deletions

File tree

tests/e2e/test_transactions.py

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -616,21 +616,17 @@ def test_cursor_tables_non_transactional_after_concurrent_create(
616616
class TestMstBlockedSql:
617617
"""SQL introspection statements inside active transactions.
618618
619-
MSTCheckRule enforcement varies by SQL on Python/Thrift. Some SHOW/DESCRIBE
620-
variants are blocked (throw + abort txn); others succeed silently — likely
621-
because the Thrift path routes them through metadata RPCs that bypass
622-
MSTCheckRule.
619+
The server restricts MST to a specific allowlist of commands. The error
620+
message from TRANSACTION_NOT_SUPPORTED.COMMAND is explicit:
621+
"Only SELECT / INSERT / MERGE / UPDATE / DELETE / DESCRIBE TABLE are supported."
623622
624623
Blocked (throw + abort txn):
625-
- SHOW TABLES, SHOW SCHEMAS, SHOW CATALOGS, SHOW FUNCTIONS
626-
- DESCRIBE TABLE EXTENDED
624+
- SHOW COLUMNS, SHOW TABLES, SHOW SCHEMAS, SHOW CATALOGS, SHOW FUNCTIONS
625+
- DESCRIBE QUERY, DESCRIBE TABLE EXTENDED
627626
- SELECT FROM information_schema
628627
629-
NOT blocked on Python/Thrift (succeed silently):
630-
- SHOW COLUMNS, DESCRIBE TABLE, DESCRIBE QUERY
631-
632-
This differs from JDBC where all of these throw. Documented here so
633-
regressions in either direction are caught.
628+
Allowed:
629+
- DESCRIBE TABLE (basic form — explicitly listed in server's allowlist)
634630
"""
635631

636632
def _assert_blocked_and_txn_aborted(self, mst_conn_params, fq_table, blocked_sql):
@@ -700,35 +696,27 @@ def test_information_schema_blocked(self, mst_conn_params, mst_table, mst_catalo
700696
f"SELECT * FROM {mst_catalog}.information_schema.columns LIMIT 1",
701697
)
702698

703-
# ----- Not blocked on Python/Thrift (diverges from JDBC) -----
704-
705-
def test_show_columns_not_blocked_on_thrift(self, mst_conn_params, mst_table):
706-
"""SHOW COLUMNS IN <table> succeeds in MST on Python/Thrift.
707-
708-
Diverges from JDBC where it's blocked by MSTCheckRule.
709-
"""
699+
def test_show_columns_blocked(self, mst_conn_params, mst_table):
700+
"""SHOW COLUMNS is blocked in MST (ShowDeltaTableColumnsCommand)."""
710701
fq_table, _ = mst_table
711-
self._assert_not_blocked(
702+
self._assert_blocked_and_txn_aborted(
712703
mst_conn_params, fq_table, f"SHOW COLUMNS IN {fq_table}"
713704
)
714705

715-
def test_describe_query_not_blocked_on_thrift(self, mst_conn_params, mst_table):
716-
"""DESCRIBE QUERY succeeds in MST on Python/Thrift.
717-
718-
Diverges from JDBC where it's blocked by MSTCheckRule.
719-
"""
706+
def test_describe_query_blocked(self, mst_conn_params, mst_table):
707+
"""DESCRIBE QUERY is blocked in MST (DescribeQueryCommand)."""
720708
fq_table, _ = mst_table
721-
self._assert_not_blocked(
709+
self._assert_blocked_and_txn_aborted(
722710
mst_conn_params,
723711
fq_table,
724712
f"DESCRIBE QUERY SELECT * FROM {fq_table}",
725713
)
726714

727-
def test_describe_table_not_blocked_on_thrift(self, mst_conn_params, mst_table):
728-
"""DESCRIBE TABLE succeeds in MST on Python/Thrift.
729-
730-
Diverges from JDBC where it's blocked by MSTCheckRule.
731-
"""
715+
# DESCRIBE TABLE is explicitly listed as an allowed command in the server's
716+
# TRANSACTION_NOT_SUPPORTED.COMMAND error message:
717+
# "Only SELECT / INSERT / MERGE / UPDATE / DELETE / DESCRIBE TABLE are supported."
718+
def test_describe_table_not_blocked(self, mst_conn_params, mst_table):
719+
"""DESCRIBE TABLE succeeds in MST — explicitly allowed by the server."""
732720
fq_table, _ = mst_table
733721
self._assert_not_blocked(
734722
mst_conn_params, fq_table, f"DESCRIBE TABLE {fq_table}"

0 commit comments

Comments
 (0)