File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -892,6 +892,7 @@ class Generator(generator.Generator):
892892 # There's no list in docs, but it can be found in Clickhouse code
893893 # see `ClickHouse/src/Parsers/ParserCreate*.cpp`
894894 ON_CLUSTER_TARGETS = {
895+ "SCHEMA" , # Transpiled CREATE SCHEMA may have OnCluster property set
895896 "DATABASE" ,
896897 "TABLE" ,
897898 "VIEW" ,
Original file line number Diff line number Diff line change @@ -622,6 +622,14 @@ def test_ddl(self):
622622 )
623623 self .assertEqual (create_with_cluster .sql ("clickhouse" ), "CREATE DATABASE foo ON CLUSTER c" )
624624
625+ # Transpiled CREATE SCHEMA may have OnCluster property set
626+ create_with_cluster = exp .Create (
627+ this = db_table_expr ,
628+ kind = "SCHEMA" ,
629+ properties = exp .Properties (expressions = [exp .OnCluster (this = exp .to_identifier ("c" ))]),
630+ )
631+ self .assertEqual (create_with_cluster .sql ("clickhouse" ), "CREATE DATABASE foo ON CLUSTER c" )
632+
625633 ctas_with_comment = exp .Create (
626634 this = exp .table_ ("foo" ),
627635 kind = "TABLE" ,
You can’t perform that action at this time.
0 commit comments