-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsnowflake_top_level_stmts_test.go
More file actions
39 lines (35 loc) · 974 Bytes
/
snowflake_top_level_stmts_test.go
File metadata and controls
39 lines (35 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2026 GoSQLX Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
package parser_test
import (
"testing"
"github.com/ajitpratap0/GoSQLX/pkg/gosqlx"
"github.com/ajitpratap0/GoSQLX/pkg/sql/keywords"
)
// TestSnowflakeUseAndDescribe verifies Snowflake session-context statements
// (USE WAREHOUSE/DATABASE/SCHEMA/ROLE) and DESCRIBE/DESC with object-kind
// prefixes. Regression for #483.
func TestSnowflakeUseAndDescribe(t *testing.T) {
queries := []string{
`USE WAREHOUSE compute_wh`,
`USE DATABASE my_db`,
`USE SCHEMA analytics`,
`USE ROLE analyst`,
`USE my_db`,
`USE my_db.public`,
`DESCRIBE TABLE users`,
`DESCRIBE VIEW user_summary`,
`DESCRIBE STAGE my_stage`,
`DESC TABLE users`,
`DESC users`,
}
for _, q := range queries {
q := q
t.Run(q, func(t *testing.T) {
if _, err := gosqlx.ParseWithDialect(q, keywords.DialectSnowflake); err != nil {
t.Fatalf("parse failed: %v", err)
}
})
}
}