From 139b61d941836298794fcbeb179dc49c43d3fd95 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 31 Jul 2024 09:55:38 +0200 Subject: Adding upstream version 25.8.1. Signed-off-by: Daniel Baumann --- tests/dialects/test_tsql.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/dialects/test_tsql.py') diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py index 9658a02..cfdcb8d 100644 --- a/tests/dialects/test_tsql.py +++ b/tests/dialects/test_tsql.py @@ -48,6 +48,16 @@ class TestTSQL(Validator): "SELECT 1 WHERE EXISTS(SELECT 1)", ) + self.validate_all( + "WITH A AS (SELECT 2 AS value), C AS (SELECT * FROM A) SELECT * INTO TEMP_NESTED_WITH FROM (SELECT * FROM C) AS temp", + read={ + "snowflake": "CREATE TABLE TEMP_NESTED_WITH AS WITH C AS (WITH A AS (SELECT 2 AS value) SELECT * FROM A) SELECT * FROM C", + "tsql": "WITH A AS (SELECT 2 AS value), C AS (SELECT * FROM A) SELECT * INTO TEMP_NESTED_WITH FROM (SELECT * FROM C) AS temp", + }, + write={ + "snowflake": "CREATE TABLE TEMP_NESTED_WITH AS WITH A AS (SELECT 2 AS value), C AS (SELECT * FROM A) SELECT * FROM (SELECT * FROM C) AS temp", + }, + ) self.validate_all( "SELECT IIF(cond <> 0, 'True', 'False')", read={ @@ -797,6 +807,7 @@ class TestTSQL(Validator): f"UNIQUE {clustered_keyword} ([internal_id] ASC))", ) + self.validate_identity("CREATE VIEW t AS WITH cte AS (SELECT 1 AS c) SELECT c FROM cte") self.validate_identity( "ALTER TABLE tbl SET SYSTEM_VERSIONING=ON(HISTORY_TABLE=db.tbl, DATA_CONSISTENCY_CHECK=OFF, HISTORY_RETENTION_PERIOD=5 DAYS)" ) @@ -1135,6 +1146,11 @@ WHERE self.validate_all("ISNULL(x, y)", write={"spark": "COALESCE(x, y)"}) def test_json(self): + self.validate_identity( + """JSON_QUERY(REPLACE(REPLACE(x , '''', '"'), '""', '"'))""", + """ISNULL(JSON_QUERY(REPLACE(REPLACE(x, '''', '"'), '""', '"'), '$'), JSON_VALUE(REPLACE(REPLACE(x, '''', '"'), '""', '"'), '$'))""", + ) + self.validate_all( "JSON_QUERY(r.JSON, '$.Attr_INT')", write={ -- cgit v1.2.3