feat(plugins): add Snowflake database driver (#1420)#1580
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e90b05ba2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| static let defaultPrimaryKeyColumn: String? = nil | ||
| static let structureColumnFields: [StructureColumnField] = [.name, .type, .nullable, .defaultValue, .comment] | ||
| static let supportsCascadeDrop = true | ||
| static let supportsDropDatabase = true |
There was a problem hiding this comment.
Disable drop-database support or implement it
When the Snowflake metadata advertises database dropping, the app can enable the database-delete flow for Snowflake connections, but SnowflakePluginDriver does not override dropDatabase(name:), so it falls back to the PluginDatabaseDriver default that throws “Drop database is not supported.” Either implement DROP DATABASE for this driver or set this capability (and the mirrored CloudDefaults flag) to false so users are not offered an action that always fails.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch — implemented createDatabase/dropDatabase (plus the create-database form spec) in aabf4c7, mirroring the BigQuery driver: CREATE DATABASE / DROP DATABASE IF EXISTS with quoted identifiers.
|
I have read the CLA Document and I hereby sign the CLA. |
Signed-off-by: Santiago Montoya A. <xantiagoma@gmail.com>
|
Triage of the macOS App Tests failure on this PR — none of the failures originate here:
Will update the branch from 🤖 Generated with Claude Code |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… the Snowflake driver Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Adds a Snowflake database driver plugin, addressing #1420.
The driver speaks the Snowflake connector REST protocol (
/session/v1/login-request+/queries/v1/query-request) — the same wire protocol the official drivers use — and supports every authentication method from the issue:CLIENT_REQUEST_MFA_TOKEN), so a code is only needed once per token lifetime when the account allows cachingSNOWFLAKE_JWT, including encrypted keys (passphrase) and SPKI public-key fingerprintsEXTERNALBROWSER) with a localhost callback listener for the IdP redirect~/.snowflake/connections.toml/config.tomlby connection nameAlso implements session token renewal on expiry (390112), query cancellation via abort-request, encrypted (SSE-C) result-chunk download with gzip inflation, database/schema navigation with
USE, DDL viaGET_DDL, and a Snowflake SQL dialect (375 functions / 172 keywords / 43 data types harvested from the official SQL reference) for highlighting and completions.scripts/add-snowflake-to-xcode.rbwires the.tableplugintarget, and the registry release workflow gets asnowflakecase.One protocol gotcha worth recording:
/queries/v1/query-requestsilently rejects UPPERCASE UUIDs inrequestIdwith an empty HTTP 400 (Swift'sUUID().uuidStringdefault), while the login endpoint accepts them — every official connector emits lowercase by language convention, so their code never mentions it.The second commit adds two DEBUG-only development affordances (both compiled out of Release builds):
TABLEPRO_ALLOW_UNSIGNED_PLUGINS=1to load locally built plugins past the team-signature check, and a file-based keychain fallback when the build lacks an application identifier. Without these, contributors cannot run a plugin they build, since only CI holds the team certificate. Happy to drop or rework that commit if you prefer another approach.Testing
swiftlint lint --strictclean on all changed filesDatabaseTypepackage tests updated and passing (18 known types)SQLCompletionProviderTests/testProviderAcceptsDatabaseTypeandtestMySQLProviderTypesfail order-dependently when the autocomplete suites run together — reproduces identically onmain, unrelated to this PR (can file a separate issue)Checklist
CHANGELOG.mdupdated under[Unreleased]docs/databases/snowflake.mdx+ navigation)swiftformatskipped: the repo.swiftformatuses--ifdefindent, which current Homebrew swiftformat doesn't recognize)Closes #1420
🤖 Generated with Claude Code