Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

snowflake driver: introduce snowflake type.

spinningbote04f6cace644
diff --git a/plugin/db/driver.go b/plugin/db/driver.go
index ad02d2c61d..a89b22c31e 100644
--- a/plugin/db/driver.go
+++ b/plugin/db/driver.go
@@ -20,6 +20,7 @@ const (
ClickHouse Type = "CLICKHOUSE"
MySQL Type = "MYSQL"
Postgres Type = "POSTGRES"
+ Snowflake Type = "SNOWFLAKE"
TiDB Type = "TIDB"
)
@@ -423,6 +424,8 @@ func (p *QueryParams) QueryString() string {
return mysqlQuery(p.Names)
case ClickHouse:
return mysqlQuery(p.Names)
+ case Snowflake:
+ return mysqlQuery(p.Names)
case Postgres:
return pgQuery(p.Names)
}
diff --git a/server/issue.go b/server/issue.go
index 4255854c80..9d3f9ddca1 100644
--- a/server/issue.go
+++ b/server/issue.go
@@ -61,6 +61,19 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
fmt.Sprintf("Failed to create issue, ClickHouse does not support collation, got %s\n", taskCreate.Collation),
)
}
+ } else if instance.Engine == db.Snowflake {
+ if taskCreate.CharacterSet != "" {
+ return echo.NewHTTPError(
+ http.StatusBadRequest,
+ fmt.Sprintf("Failed to create issue, Snowflake does not support character set, got %s\n", taskCreate.CharacterSet),
+ )
+ }
+ if taskCreate.Collation != "" {
+ return echo.NewHTTPError(
+ http.StatusBadRequest,
+ fmt.Sprintf("Failed to create issue, Snowflake does not support collation, got %s\n", taskCreate.Collation),
+ )
+ }
} else {
if taskCreate.CharacterSet == "" {
return echo.NewHTTPError(http.StatusBadRequest, "Failed to create issue, character set missing")
@@ -427,6 +440,8 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
}
case db.ClickHouse:
payload.Statement = fmt.Sprintf("CREATE DATABASE `%s`", taskCreate.DatabaseName)
+ case db.Snowflake:
+ payload.Statement = fmt.Sprintf("CREATE DATABASE %s", taskCreate.DatabaseName)
}
bytes, err := json.Marshal(payload)
if err != nil {
diff --git a/store/migration/10001__init_schema.sql b/store/migration/10001__init_schema.sql
index eab11c3cdd..17856525a5 100644
--- a/store/migration/10001__init_schema.sql
+++ b/store/migration/10001__init_schema.sql
@@ -340,7 +340,7 @@ CREATE TABLE instance (
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
environment_id INTEGER NOT NULL REFERENCES environment (id),
name TEXT NOT NULL,
- `engine` TEXT NOT NULL CHECK (`engine` IN ('MYSQL', 'POSTGRES', 'TIDB', 'CLICKHOUSE')),
+ `engine` TEXT NOT NULL CHECK (`engine` IN ('MYSQL', 'POSTGRES', 'TIDB', 'CLICKHOUSE', 'SNOWFLAKE')),
engine_version TEXT NOT NULL DEFAULT '',
host TEXT NOT NULL,
port TEXT NOT NULL,