feat(database): add Snowflake data sources (#2972)

Snowflake is a built-in data source kind: connection dialog, key-pair, browser single sign-on, password or token sign-in, the database tree, SQL consoles, and Snowflake-aware SQL assistance and syntax colours. The driver speaks Snowflake's session protocol over the existing reqwest + rustls stack, with no JDBC/ODBC or native library and no new package. Metadata is read with SHOW / DESCRIBE, which need no running warehouse; introspected names are kept on disk for completion.

Co-authored-by: vvnadolskyy <[email protected]>
Цей коміт міститься в:
pHтаvvnadolskyy authored and GitHub committed 2026-11-12 23:06:10 +08:00
1 джерело 51c14d3b03
коміт 59eb6446d4
89 files changed
+12461 -139

No files matched your search

+50
Переглянути файл
@@ -25,4 +25,54 @@ describe("isReadOnlyQuery", () => {
])
expect(isReadOnlyQuery(text, "postgres"), text).toBe(false);
});
it("classifies Snowflake statements", () => {
for (const text of [
"SELECT src:a::string FROM t // insert",
"with x as (select 1) select * from x",
"SHOW TABLES IN SCHEMA db.public",
"describe table t",
"DESC VIEW v",
"EXPLAIN SELECT 1",
"LIST @my_stage/path",
"ls @~",
"TABLE t",
"VALUES (1), (2)",
"select $1 from @my_stage/data (file_format => 'ff')",
])
expect(isReadOnlyQuery(text, "snowflake"), text).toBe(true);
for (const text of [
"COPY INTO t FROM @my_stage",
"PUT file:///tmp/a.csv @my_stage",
"GET @my_stage file:///tmp/",
"REMOVE @my_stage/path",
"rm @~/x",
"MERGE INTO t USING s ON t.id = s.id WHEN MATCHED THEN UPDATE SET a = 1",
"CALL my_proc()",
"EXECUTE IMMEDIATE $$ select 1 $$",
"USE SCHEMA public",
"ALTER SESSION SET TIMEZONE = 'UTC'",
"CREATE OR REPLACE TABLE t (a int)",
"DROP TABLE t",
"UNDROP TABLE t",
"TRUNCATE TABLE t",
"GRANT SELECT ON t TO ROLE r",
"REVOKE SELECT ON t FROM ROLE r",
"BEGIN",
"COMMIT",
"ROLLBACK",
"SET v = 1",
"UNSET v",
"INSERT INTO t VALUES (1)",
"UPDATE t SET a = 1",
"DELETE FROM t",
"select seq.nextval",
"select system$cancel_query('x')",
"select * from table(result_scan(last_query_id()))",
"show tables ->> delete from t",
])
expect(isReadOnlyQuery(text, "snowflake"), text).toBe(false);
// Stage listings are Snowflake's alone.
expect(isReadOnlyQuery("LIST @my_stage", "postgres")).toBe(false);
});
});