File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,24 @@ def test_alter_view_with_variables(self):
8282 assert str (ast ) == str (expected_ast )
8383 assert ast .to_tree () == expected_ast .to_tree ()
8484
85+ def test_create_view_with_using_clause (self ):
86+ """Test CREATE VIEW with USING clause"""
87+ sql = 'create view test_view as (select * from local_mysql.test_house where sqft = @myvar) using test = 1, params = {"x": "y"}'
88+ ast = parse_sql (sql )
89+
90+ assert ast .name .to_string () == 'test_view'
91+ assert ast .query_str == 'select * from local_mysql.test_house where sqft = @myvar'
92+ assert ast .using == {'test' : 1 , 'params' : {'x' : 'y' }}
93+
94+ def test_alter_view_with_using_clause (self ):
95+ """Test ALTER VIEW with USING clause"""
96+ sql = 'ALTER VIEW myview AS (select * from tbl) USING param1 = "value1", param2 = 123'
97+ ast = parse_sql (sql )
98+
99+ assert ast .name .to_string () == 'myview'
100+ assert ast .query_str == 'select * from tbl'
101+ assert ast .using == {'param1' : 'value1' , 'param2' : 123 }
102+
85103 # def test_create_dataset_full(self):
86104 # sql = "CREATE DATASET my_view FROM integr AS ( SELECT * FROM pred )"
87105 # ast = parse_sql(sql)
You can’t perform that action at this time.
0 commit comments