MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_delete_against_cte_directly

Method test_delete_against_cte_directly

test/sql/test_cte.py:1724–1742  ·  view source on GitHub ↗

test #6464. SQL-Server specific arrangement seems to allow DELETE from a CTE directly.

(self)

Source from the content-addressed store, hash-verified

1722 eq_(stmt.compile().isupdate, True)
1723
1724 def test_delete_against_cte_directly(self):
1725 """test #6464.
1726
1727 SQL-Server specific arrangement seems to allow
1728 DELETE from a CTE directly.
1729
1730 """
1731 products = table("products", column("id"), column("price"))
1732
1733 cte = products.select().cte("pd")
1734
1735 stmt = delete(cte)
1736
1737 self.assert_compile(
1738 stmt,
1739 "WITH pd AS (SELECT products.id AS id, products.price AS price "
1740 "FROM products) DELETE FROM pd",
1741 )
1742 eq_(stmt.compile().isdelete, True)
1743
1744 def test_delete_against_user_textual_cte(self):
1745 """test #6464.

Callers

nothing calls this directly

Calls 8

tableFunction · 0.90
columnFunction · 0.90
deleteFunction · 0.90
eq_Function · 0.90
assert_compileMethod · 0.80
cteMethod · 0.45
selectMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected