Skip to content

feat: add database-integrations package (types + env vars) - #70

Merged
saltenasl merged 82 commits into
mainfrom
jk/feat/sql-integrations
Nov 1, 2025
Merged

saltenasl merged 82 commits into
mainfrom
jk/feat/sql-integrations

Conversation

@jankuca

@jankuca jankuca commented Oct 30, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • New database-integrations package: typed connection builders that produce SQLAlchemy-ready inputs for many providers, Snowflake federated-auth support, SSL/SSH/CA handling, env-var generation, and consolidated public exports.
  • Documentation
    • Comprehensive README with overview, usage examples, config and API reference for integrations.
  • Tests
    • Extensive provider test suites added; test discovery widened and a URL-query-params matcher added to test setup.
  • Chores
    • Updated spellchecker word list; added TypeScript SDK VS Code setting.

@coderabbitai

coderabbitai Bot commented Oct 30, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a new package @deepnote/database-integrations with typed integration identifiers, Zod metadata schemas, SQLAlchemy input types, federated-auth utilities, and env-var builders (getEnvironmentVariablesForIntegrations, getSqlAlchemyInput). Implements Snowflake federated and non‑federated URL/key‑pair builders, CA/TLS/SSH handling, BigQuery/Spanner parse errors, and env-var naming utilities. Includes package manifest, README, extensive unit tests, a Vitest setup with a custom URL matcher, and cspell/vitest config updates.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Consumer
  participant Index as "database-integrations index"
  participant EnvBuilder as "getEnvironmentVariablesForIntegrations"
  participant Validator as "Zod schemas"
  participant Dispatcher as "getSqlAlchemyInput"
  participant Snowflake as "Snowflake builders"
  participant CA as "getCACertificatePath"
  participant Errors as "ParseErrors"

  Consumer->>Index: import API
  Consumer->>EnvBuilder: request env vars for integrations + params
  EnvBuilder->>Validator: validate each integration metadata
  alt validation fails
    Validator-->>EnvBuilder: validation errors
    EnvBuilder->>Consumer: return errors + partial results
  else validation succeeds
    loop per integration
      EnvBuilder->>Dispatcher: request SqlAlchemyInput
      alt federated auth detected
        Dispatcher->>Snowflake: build federated URL/params (or return null)
        Snowflake-->>Dispatcher: SqlAlchemyInput | null
      else non-federated
        Dispatcher->>CA: resolve CA cert path/text if needed
        CA-->>Dispatcher: caCertificate info
        Dispatcher-->>EnvBuilder: SqlAlchemyInput
      end
    end
    EnvBuilder->>Consumer: aggregated EnvVar entries
  end
  par parse errors
    Dispatcher->>Errors: throw structured parse error (BigQuery/Spanner)
    Errors-->>EnvBuilder: error details
    EnvBuilder->>Consumer: include parse error details
  end
Loading

Possibly related PRs

Suggested reviewers

  • saltenasl
  • Artmann

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: add database-integrations package (types + env vars)" directly and accurately describes the primary change: introduction of a new @deepnote/database-integrations package containing type definitions, environment variable generation utilities, metadata schemas, and authentication method handling. The title follows conventional commit format, is concise at 58 characters, and clearly conveys what was added without vague language or noise. A teammate reviewing commit history would immediately understand that this PR introduces a complete new package for database integration functionality.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 24

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c19d0da and b5b6517.

📒 Files selected for processing (9)
  • packages/sql-integrations/src/index.ts (1 hunks)
  • packages/sql-integrations/src/sql-auth-methods.ts (1 hunks)
  • packages/sql-integrations/src/sql-code-samples.ts (1 hunks)
  • packages/sql-integrations/src/sql-constants.ts (1 hunks)
  • packages/sql-integrations/src/sql-integrations-config.ts (1 hunks)
  • packages/sql-integrations/src/sql-metadata-types.ts (1 hunks)
  • packages/sql-integrations/src/sql-structure-constants.ts (1 hunks)
  • packages/sql-integrations/src/sql-structure-utils.ts (1 hunks)
  • packages/sql-integrations/src/sql-validation-schemas.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
packages/*/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/src/**/*.{ts,tsx}: Use strict type checking and prefer type safety over convenience
Use const for immutable values
Avoid any; use proper type definitions and type guards

Files:

  • packages/sql-integrations/src/sql-metadata-types.ts
  • packages/sql-integrations/src/sql-structure-utils.ts
  • packages/sql-integrations/src/sql-validation-schemas.ts
  • packages/sql-integrations/src/sql-integrations-config.ts
  • packages/sql-integrations/src/sql-structure-constants.ts
  • packages/sql-integrations/src/sql-constants.ts
  • packages/sql-integrations/src/sql-code-samples.ts
  • packages/sql-integrations/src/sql-auth-methods.ts
  • packages/sql-integrations/src/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow Biome's lint rules as configured in biome.json
Use literal keys (dot notation) instead of bracket notation when possible
Prefer single quotes for strings (except when avoiding escapes)

Files:

  • packages/sql-integrations/src/sql-metadata-types.ts
  • packages/sql-integrations/src/sql-structure-utils.ts
  • packages/sql-integrations/src/sql-validation-schemas.ts
  • packages/sql-integrations/src/sql-integrations-config.ts
  • packages/sql-integrations/src/sql-structure-constants.ts
  • packages/sql-integrations/src/sql-constants.ts
  • packages/sql-integrations/src/sql-code-samples.ts
  • packages/sql-integrations/src/sql-auth-methods.ts
  • packages/sql-integrations/src/index.ts
packages/*/src/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Place source code under packages/*/src/

Files:

  • packages/sql-integrations/src/sql-metadata-types.ts
  • packages/sql-integrations/src/sql-structure-utils.ts
  • packages/sql-integrations/src/sql-validation-schemas.ts
  • packages/sql-integrations/src/sql-integrations-config.ts
  • packages/sql-integrations/src/sql-structure-constants.ts
  • packages/sql-integrations/src/sql-constants.ts
  • packages/sql-integrations/src/sql-code-samples.ts
  • packages/sql-integrations/src/sql-auth-methods.ts
  • packages/sql-integrations/src/index.ts
🧬 Code graph analysis (8)
packages/sql-integrations/src/sql-metadata-types.ts (1)
packages/sql-integrations/src/sql-auth-methods.ts (3)
  • SnowflakeAuthMethods (3-10)
  • DatabaseAuthMethods (21-24)
  • BigQueryAuthMethods (14-17)
packages/sql-integrations/src/sql-structure-utils.ts (1)
packages/sql-integrations/src/index.ts (4)
  • QuotingSymbol (49-49)
  • getQuotingSymbol (50-50)
  • surroundWithQuotes (50-50)
  • needsQuoting (50-50)
packages/sql-integrations/src/sql-validation-schemas.ts (1)
packages/sql-integrations/src/sql-auth-methods.ts (2)
  • SnowflakeAuthMethods (3-10)
  • BigQueryAuthMethods (14-17)
packages/sql-integrations/src/sql-integrations-config.ts (1)
packages/sql-integrations/src/index.ts (1)
  • sqlIntegrationsConfig (59-59)
packages/sql-integrations/src/sql-structure-constants.ts (1)
packages/sql-integrations/src/index.ts (2)
  • MAX_TABLES_FOR_INTEGRATION_STRUCTURE (53-53)
  • MAX_TABLES_FOR_FETCHING_COLUMNS (53-53)
packages/sql-integrations/src/sql-constants.ts (1)
packages/sql-integrations/src/index.ts (10)
  • SQL_CELL_INTEGRATIONS (36-36)
  • INTEGRATIONS_WITH_SCHEMA (37-37)
  • INTEGRATIONS_WITH_TABLE_METADATA (38-38)
  • integrationsWithConfigurableSSL (39-39)
  • integrationsWithSSLSupport (40-40)
  • SqlCellIntegrationType (41-41)
  • IntegrationTypeWithSchema (42-42)
  • NarrowedIntegrationTypeWithSchema (43-43)
  • IntegrationTypeWithTableMetadata (44-44)
  • NarrowedIntegrationTypeWithTableMetadata (45-45)
packages/sql-integrations/src/sql-code-samples.ts (2)
packages/sql-integrations/src/index.ts (1)
  • sqlIntegrationsCodeSamples (56-56)
packages/blocks/src/blocks/sql-utils.ts (1)
  • convertToEnvironmentVariableName (1-9)
packages/sql-integrations/src/sql-auth-methods.ts (1)
packages/sql-integrations/src/index.ts (6)
  • SnowflakeAuthMethods (3-3)
  • SnowflakeAuthMethod (4-4)
  • BigQueryAuthMethods (5-5)
  • BigQueryAuthMethod (6-6)
  • DatabaseAuthMethods (7-7)
  • DatabaseAuthMethod (8-8)
🪛 GitHub Actions: CI
packages/sql-integrations/src/sql-metadata-types.ts

[error] 1-2: lint/correctness/noUnusedImports: This import is unused. Remove unused imports.


[warning] 3-3: lint/style/useImportType: All these imports are only used as types. Consider using import type.


[error] 201-203: Formatter would have printed different content. Formatting issues detected in this file.

packages/sql-integrations/src/sql-structure-utils.ts

[warning] 13-13: Unknown word (pgsql)

packages/sql-integrations/src/sql-validation-schemas.ts

[error] 72-74: Formatter would have printed different content. Formatting issues detected in this file.

packages/sql-integrations/src/sql-integrations-config.ts

[warning] 8-8: Unknown word (pgsql)


[warning] 17-17: Unknown word (mindsdb)


[warning] 34-34: Unknown word (pgsql)


[warning] 71-71: Unknown word (mindsdb)


[warning] 73-73: Unknown word (mindsdb)


[warning] 94-94: Unknown word (lakehouse)

packages/sql-integrations/src/sql-structure-constants.ts

[error] 6-8: Formatter would have printed different content. Formatting issues detected in this file.

packages/sql-integrations/src/sql-constants.ts

[warning] 4-4: Unknown word (pgsql)


[warning] 13-13: Unknown word (mindsdb)


[warning] 24-24: Unknown word (pgsql)


[warning] 38-38: Unknown word (pgsql)


[warning] 44-44: Unknown word (mindsdb)


[warning] 47-47: Unknown word (pgsql)

packages/sql-integrations/src/sql-code-samples.ts

[warning] 13-13: Unknown word (pymongo)


[warning] 14-14: Unknown word (pprint)


[warning] 14-14: Unknown word (pprint)


[warning] 39-39: Unknown word (SSLENABLED)


[warning] 60-60: Unknown word (pgsql)

packages/sql-integrations/src/sql-auth-methods.ts

[error] 26-28: Biome formatter would have printed different content. Formatting issues in this file (export type lines).

packages/sql-integrations/src/index.ts

[error] 59-60: Biome formatter would have printed different content. Formatting issues detected in this file.

🪛 GitHub Check: Typecheck
packages/sql-integrations/src/sql-metadata-types.ts

[failure] 99-99:
Cannot find name 'AwsAuthMethods'. Did you mean 'AwsAuthMethod'?


[failure] 1-1:
Cannot find module '../integration-schemata' or its corresponding type declarations.

packages/sql-integrations/src/sql-structure-utils.ts

[failure] 1-1:
Cannot find module '../integration-types' or its corresponding type declarations.

packages/sql-integrations/src/sql-validation-schemas.ts

[failure] 1-1:
Cannot find module 'zod' or its corresponding type declarations.

packages/sql-integrations/src/sql-integrations-config.ts

[failure] 3-3:
Cannot find module '../integrations-config' or its corresponding type declarations.


[failure] 1-1:
Cannot find module '@deepnote/routes' or its corresponding type declarations.

packages/sql-integrations/src/sql-constants.ts

[failure] 1-1:
Cannot find module '../integration-types' or its corresponding type declarations.

packages/sql-integrations/src/sql-code-samples.ts

[failure] 3-3:
Cannot find module '../integration-types' or its corresponding type declarations.


[failure] 1-1:
Cannot find module '../../utils/utils' or its corresponding type declarations.

packages/sql-integrations/src/sql-auth-methods.ts

[failure] 1-1:
Cannot find module 'ts-essentials' or its corresponding type declarations.

🔇 Additional comments (3)
packages/sql-integrations/src/sql-code-samples.ts (1)

8-114: LGTM! Python code samples are well-structured.

Samples correctly use environment variables and provide clear examples for MongoDB, MySQL, PostgreSQL, and Snowflake.

packages/sql-integrations/src/sql-constants.ts (1)

3-64: LGTM! Well-structured type definitions and constants.

The use of as const and derived types provides excellent type safety. The narrowed types are particularly useful for conditional typing.

packages/sql-integrations/src/sql-metadata-types.ts (1)

3-3: Use import type for type-only imports.

As per coding guidelines and the lint warning.

-import { BigQueryAuthMethods, DatabaseAuthMethods, SnowflakeAuthMethods } from './sql-auth-methods'
+import type { BigQueryAuthMethods, DatabaseAuthMethods, SnowflakeAuthMethods } from './sql-auth-methods'

Wait, actually these are used as values in discriminated unions (e.g., typeof SnowflakeAuthMethods.PASSWORD), so this would break. Ignore the lint warning here.

Comment thread packages/sql-integrations/src/index.ts Resolved
@jankuca
jankuca force-pushed the jk/feat/sql-integrations branch from b5b6517 to cd847bb Compare October 30, 2025 13:20

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

♻️ Duplicate comments (2)
packages/sql-integrations/src/sql-integration-auth-methods.ts (1)

28-31: Naming is consistent across all auth method objects.

The past review comment suggesting UPPER_SNAKE_CASE appears incorrect. All auth methods (AwsAuthMethods, SnowflakeAuthMethods, BigQueryAuthMethods, DatabaseAuthMethods) consistently use PascalCase for keys, which is idiomatic TypeScript style for constant object keys.

packages/sql-integrations/src/index.ts (1)

1-25: Barrel exports are clean.

The past review comment about Biome formatting at lines 59-60 doesn't apply to this 25-line file. The export structure looks good.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b5b6517 and cd847bb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • cspell.json (1 hunks)
  • packages/sql-integrations/README.md (1 hunks)
  • packages/sql-integrations/package.json (1 hunks)
  • packages/sql-integrations/src/index.ts (1 hunks)
  • packages/sql-integrations/src/sql-integration-auth-methods.ts (1 hunks)
  • packages/sql-integrations/src/sql-integration-metadata-schemas.ts (1 hunks)
  • packages/sql-integrations/src/sql-integration-metadata-types.ts (1 hunks)
  • packages/sql-integrations/src/sql-integration-types.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
packages/*/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/src/**/*.{ts,tsx}: Use strict type checking and prefer type safety over convenience
Use const for immutable values
Avoid any; use proper type definitions and type guards

Files:

  • packages/sql-integrations/src/sql-integration-metadata-schemas.ts
  • packages/sql-integrations/src/sql-integration-auth-methods.ts
  • packages/sql-integrations/src/sql-integration-metadata-types.ts
  • packages/sql-integrations/src/index.ts
  • packages/sql-integrations/src/sql-integration-types.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow Biome's lint rules as configured in biome.json
Use literal keys (dot notation) instead of bracket notation when possible
Prefer single quotes for strings (except when avoiding escapes)

Files:

  • packages/sql-integrations/src/sql-integration-metadata-schemas.ts
  • packages/sql-integrations/src/sql-integration-auth-methods.ts
  • packages/sql-integrations/src/sql-integration-metadata-types.ts
  • packages/sql-integrations/src/index.ts
  • packages/sql-integrations/src/sql-integration-types.ts
packages/*/src/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Place source code under packages/*/src/

Files:

  • packages/sql-integrations/src/sql-integration-metadata-schemas.ts
  • packages/sql-integrations/src/sql-integration-auth-methods.ts
  • packages/sql-integrations/src/sql-integration-metadata-types.ts
  • packages/sql-integrations/src/index.ts
  • packages/sql-integrations/src/sql-integration-types.ts
**/*.{md,yml,yaml}

📄 CodeRabbit inference engine (CLAUDE.md)

Use Prettier formatting for Markdown and YAML files

Files:

  • packages/sql-integrations/README.md
🧬 Code graph analysis (4)
packages/sql-integrations/src/sql-integration-metadata-schemas.ts (2)
packages/sql-integrations/src/sql-integration-auth-methods.ts (2)
  • BigQueryAuthMethods (21-24)
  • SnowflakeAuthMethods (10-17)
packages/sql-integrations/src/sql-integration-types.ts (1)
  • SqlIntegrationType (22-22)
packages/sql-integrations/src/sql-integration-auth-methods.ts (1)
packages/sql-integrations/src/index.ts (8)
  • AwsAuthMethods (4-4)
  • AwsAuthMethod (3-3)
  • SnowflakeAuthMethods (10-10)
  • SnowflakeAuthMethod (9-9)
  • BigQueryAuthMethods (6-6)
  • BigQueryAuthMethod (5-5)
  • DatabaseAuthMethods (8-8)
  • DatabaseAuthMethod (7-7)
packages/sql-integrations/src/sql-integration-metadata-types.ts (3)
packages/sql-integrations/src/sql-integration-metadata-schemas.ts (1)
  • sqlMetadataValidationSchemasByType (88-93)
packages/sql-integrations/src/sql-integration-auth-methods.ts (2)
  • DatabaseAuthMethods (28-31)
  • AwsAuthMethods (3-6)
packages/sql-integrations/src/sql-integration-types.ts (1)
  • SqlIntegrationType (22-22)
packages/sql-integrations/src/sql-integration-types.ts (1)
packages/sql-integrations/src/index.ts (4)
  • sqlIntegrationTypes (22-22)
  • SqlIntegrationType (21-21)
  • sqlIntegrationTypesWithConfigurableSsl (23-23)
  • sqlIntegrationTypesWithSslSupport (24-24)
🔇 Additional comments (6)
cspell.json (1)

39-82: LGTM!

The alphabetical reordering and additions of SQL integration-related terms are appropriate.

packages/sql-integrations/src/sql-integration-metadata-schemas.ts (1)

6-17: Clarify nullable authMethod for ServiceAccount.

Line 8 uses .nullable() on a literal type, allowing null | 'service-account'. This is unusual. Verify if this is intentional or if the entire object should be optional instead.

If null is a valid authMethod value, this is fine. Otherwise, consider:

-  z.object({
-    authMethod: z.literal(BigQueryAuthMethods.ServiceAccount).nullable(),
-    service_account: z.string(),
-  }),
+  z.object({
+    authMethod: z.literal(BigQueryAuthMethods.ServiceAccount),
+    service_account: z.string(),
+  }).nullable(),
packages/sql-integrations/src/sql-integration-metadata-types.ts (3)

29-48: Both 'user' and 'username' fields present.

Lines 33 and 38 both exist with a NOTE comment. If this duplication is truly necessary for backward compatibility, document which field is preferred for new integrations. Otherwise, consolidate to a single field.


36-36: Port typed as string, not number.

Several metadata interfaces (DatabaseIntegrationMetadata, MongodbIntegrationMetadata, etc.) type port as string rather than number. Verify this is intentional for serialization, or use number for type safety.


145-146: Test function ensures exhaustive type coverage.

The compile-time test correctly verifies that IntegrationMetadataByType keys match SqlIntegrationType. This will catch missing integration types at build time.

packages/sql-integrations/src/sql-integration-types.ts (1)

1-20: Review comment is incorrect.

pandas-dataframe is already present in sqlIntegrationTypes (line 12). It's not mentioned in README.md at all, so the claim about line 14 is unfounded. The code is correct as-is; pandas-dataframe appropriately appears only in the main types list, not in SSL configuration arrays.

Likely an incorrect or invalid review comment.

Comment thread packages/sql-integrations/package.json Resolved
Comment thread packages/sql-integrations/README.md Resolved
Comment thread packages/sql-integrations/README.md Resolved
Comment thread packages/sql-integrations/README.md Resolved
Comment thread packages/sql-integrations/README.md Resolved
@jankuca
jankuca force-pushed the jk/feat/sql-integrations branch from cd847bb to 8edfb2e Compare October 30, 2025 13:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cspell.json (1)

20-36: Clarify the intent of moving words from markdown-specific overrides to global scope.

The changes appear to move words from the markdown-specific overrides section (lines 20-36) to the main "words" array (lines 39-78). This expands their scope from markdown files only to all files. While the new SQL-related terms (e.g., pgsql, Instantiator, mindsdb) are appropriate for the new integrations package, it's unclear whether all words should be globally spell-checked.

Consider:

  • Keeping project-specific abbreviations (dntk, deepnote, etc.) local to markdown via overrides if they're not used elsewhere
  • Or document why the scope expansion is necessary

Also applies to: 39-78

♻️ Duplicate comments (1)
packages/sql-integrations/README.md (1)

36-52: Import BigQueryAuthMethods as a value.

The snippet erases BigQueryAuthMethods at runtime by marking it type, so BigQueryAuthMethods.ServiceAccount throws. Import the value form instead.

Apply this diff:

 import {
-  type BigQueryAuthMethods,
+  BigQueryAuthMethods,
   type IntegrationMetadataByType,
   type SqlIntegrationType,
   sqlMetadataValidationSchemasByType,
   sqlIntegrationTypes,
 } from '@deepnote/sql-integrations'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cd847bb and 8edfb2e.

📒 Files selected for processing (7)
  • cspell.json (1 hunks)
  • packages/sql-integrations/README.md (1 hunks)
  • packages/sql-integrations/src/index.ts (1 hunks)
  • packages/sql-integrations/src/sql-integration-auth-methods.ts (1 hunks)
  • packages/sql-integrations/src/sql-integration-metadata-schemas.ts (1 hunks)
  • packages/sql-integrations/src/sql-integration-metadata-types.ts (1 hunks)
  • packages/sql-integrations/src/sql-integration-types.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{md,yml,yaml}

📄 CodeRabbit inference engine (CLAUDE.md)

Use Prettier formatting for Markdown and YAML files

Files:

  • packages/sql-integrations/README.md
packages/*/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/src/**/*.{ts,tsx}: Use strict type checking and prefer type safety over convenience
Use const for immutable values
Avoid any; use proper type definitions and type guards

Files:

  • packages/sql-integrations/src/sql-integration-metadata-schemas.ts
  • packages/sql-integrations/src/sql-integration-auth-methods.ts
  • packages/sql-integrations/src/sql-integration-types.ts
  • packages/sql-integrations/src/sql-integration-metadata-types.ts
  • packages/sql-integrations/src/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow Biome's lint rules as configured in biome.json
Use literal keys (dot notation) instead of bracket notation when possible
Prefer single quotes for strings (except when avoiding escapes)

Files:

  • packages/sql-integrations/src/sql-integration-metadata-schemas.ts
  • packages/sql-integrations/src/sql-integration-auth-methods.ts
  • packages/sql-integrations/src/sql-integration-types.ts
  • packages/sql-integrations/src/sql-integration-metadata-types.ts
  • packages/sql-integrations/src/index.ts
packages/*/src/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Place source code under packages/*/src/

Files:

  • packages/sql-integrations/src/sql-integration-metadata-schemas.ts
  • packages/sql-integrations/src/sql-integration-auth-methods.ts
  • packages/sql-integrations/src/sql-integration-types.ts
  • packages/sql-integrations/src/sql-integration-metadata-types.ts
  • packages/sql-integrations/src/index.ts
🧬 Code graph analysis (4)
packages/sql-integrations/src/sql-integration-metadata-schemas.ts (2)
packages/sql-integrations/src/sql-integration-auth-methods.ts (2)
  • BigQueryAuthMethods (19-22)
  • SnowflakeAuthMethods (8-15)
packages/sql-integrations/src/sql-integration-types.ts (1)
  • SqlIntegrationType (22-22)
packages/sql-integrations/src/sql-integration-auth-methods.ts (1)
packages/sql-integrations/src/index.ts (8)
  • AwsAuthMethods (4-4)
  • AwsAuthMethod (3-3)
  • SnowflakeAuthMethods (10-10)
  • SnowflakeAuthMethod (9-9)
  • BigQueryAuthMethods (6-6)
  • BigQueryAuthMethod (5-5)
  • DatabaseAuthMethods (8-8)
  • DatabaseAuthMethod (7-7)
packages/sql-integrations/src/sql-integration-types.ts (1)
packages/sql-integrations/src/index.ts (3)
  • sqlIntegrationTypes (22-22)
  • SqlIntegrationType (21-21)
  • sqlIntegrationTypesWithSslSupport (23-23)
packages/sql-integrations/src/sql-integration-metadata-types.ts (3)
packages/sql-integrations/src/sql-integration-metadata-schemas.ts (1)
  • sqlMetadataValidationSchemasByType (88-93)
packages/sql-integrations/src/sql-integration-auth-methods.ts (2)
  • DatabaseAuthMethods (26-29)
  • AwsAuthMethods (1-4)
packages/sql-integrations/src/sql-integration-types.ts (1)
  • SqlIntegrationType (22-22)
🔇 Additional comments (1)
packages/sql-integrations/src/index.ts (1)

1-24: Clean barrel export structure.

The file is well-organized with logical grouping and proper type-only exports. Follows TypeScript best practices.

@jankuca
jankuca marked this pull request as ready for review November 1, 2025 10:42
@jankuca
jankuca requested a review from a team as a code owner November 1, 2025 10:42
coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 1, 2025
coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 1, 2025

@Artmann Artmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just left a few small comments :)

Comment thread .vscode/settings.json
"editor.formatOnSave": true,
"biome.enabled": true
"biome.enabled": true,
"typescript.tsdk": "node_modules/typescript/lib"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VS Code set this config when I made it use the TS version from the workspace. This fixed drift between typecheck in my IDE and in CI (I had different patch version locally).

Screenshot 2025-11-01 at 12 51 50


export type SqlIntegrationConfig = Extract<DatabaseIntegrationConfig, { type: SqlIntegrationType }>

export function getIntegrationListEnv(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we come up with a better name for this? Something like listEnvironmentVariablesForIntegrations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted the name to be a bit more concise. I started with getIntegrationListEnvironmentVariables.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with @Artmann I did not understand that this returns environment variables from the original name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, updated!

): {
envVars: Array<EnvVar>
errors: Array<Error>
} {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As these are functions that are exported from the library, it would be nice if we could do explicit return types so that we don't accidentally break the public contract.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are actually commenting on a return type. Is there an exported function that does not have it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh then I missread the diff!


const envVarsForThisIntegration: Array<EnvVar> = Object.entries(integration.metadata).map(([key, rawValue]) => {
const name = `${namePrefix}_${key.toUpperCase()}`
const value = String(rawValue) // converts booleans to "true" or "false"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know you could do this 😅 Nice!

Artmann
Artmann previously approved these changes Nov 1, 2025
@jankuca
jankuca dismissed stale reviews from Artmann and coderabbitai[bot] via 0c9d1be November 1, 2025 11:57
@jankuca
jankuca force-pushed the jk/feat/sql-integrations branch from 0c9d1be to c1c7e1b Compare November 1, 2025 11:58
@jankuca

jankuca commented Nov 1, 2025

Copy link
Copy Markdown
Contributor Author

I updated the name of the env var factory util. Sorry about the force push, I pushed a broken commit and fixed it right away. Just the last commit is new.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8cb7276 and c1c7e1b.

📒 Files selected for processing (4)
  • packages/database-integrations/README.md (1 hunks)
  • packages/database-integrations/src/database-integration-env-vars.test.ts (1 hunks)
  • packages/database-integrations/src/database-integration-env-vars.ts (1 hunks)
  • packages/database-integrations/src/index.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{md,yml,yaml}

📄 CodeRabbit inference engine (CLAUDE.md)

Use Prettier formatting for Markdown and YAML files

Files:

  • packages/database-integrations/README.md
packages/*/src/**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/src/**/*.test.{ts,tsx}: Place test files next to the source files with .test.ts or .test.tsx extension
Use Vitest as the testing framework for all tests
Import { describe, expect, it } from 'vitest' in tests
Use dedent from ts-dedent for multiline string comparisons in tests
Follow existing test patterns (see packages/blocks/src/blocks/*.test.ts); write clear names, group with describe(), cover edge cases, errors, special characters, and verify exact output for code-generation functions

Files:

  • packages/database-integrations/src/database-integration-env-vars.test.ts
packages/*/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/src/**/*.{ts,tsx}: Use strict type checking and prefer type safety over convenience
Use const for immutable values
Avoid any; use proper type definitions and type guards

Files:

  • packages/database-integrations/src/database-integration-env-vars.test.ts
  • packages/database-integrations/src/database-integration-env-vars.ts
  • packages/database-integrations/src/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow Biome's lint rules as configured in biome.json
Use literal keys (dot notation) instead of bracket notation when possible
Prefer single quotes for strings (except when avoiding escapes)

Files:

  • packages/database-integrations/src/database-integration-env-vars.test.ts
  • packages/database-integrations/src/database-integration-env-vars.ts
  • packages/database-integrations/src/index.ts
packages/*/src/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Place source code under packages/*/src/

Files:

  • packages/database-integrations/src/database-integration-env-vars.test.ts
  • packages/database-integrations/src/database-integration-env-vars.ts
  • packages/database-integrations/src/index.ts
🧬 Code graph analysis (2)
packages/database-integrations/src/database-integration-env-vars.test.ts (1)
packages/database-integrations/src/database-integration-env-vars.ts (4)
  • getSqlEnvVarName (721-723)
  • getEnvironmentVariablesForIntegrations (30-85)
  • BigQueryServiceAccountParseError (577-584)
  • SpannerServiceAccountParseError (609-616)
packages/database-integrations/src/database-integration-env-vars.ts (4)
packages/database-integrations/src/database-integration-metadata-schemas.ts (1)
  • DatabaseIntegrationMetadataByType (268-270)
packages/database-integrations/src/sql-integration-auth-methods.ts (5)
  • FederatedAuthMethod (42-42)
  • isFederatedAuthMethod (44-46)
  • DatabaseAuthMethods (26-29)
  • AwsAuthMethods (1-4)
  • isFederatedAuthMetadata (48-52)
packages/database-integrations/src/sql-alchemy-types.ts (1)
  • SqlAlchemyInput (4-22)
packages/database-integrations/src/snowflake-integration-env-vars.ts (1)
  • getSnowflakeSqlAlchemyInput (6-46)
🪛 markdownlint-cli2 (0.18.1)
packages/database-integrations/README.md

51-51: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


53-53: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


56-56: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c1c7e1b and caf3010.

📒 Files selected for processing (1)
  • packages/database-integrations/src/database-integration-env-vars.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
packages/*/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/src/**/*.{ts,tsx}: Use strict type checking and prefer type safety over convenience
Use const for immutable values
Avoid any; use proper type definitions and type guards

Files:

  • packages/database-integrations/src/database-integration-env-vars.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow Biome's lint rules as configured in biome.json
Use literal keys (dot notation) instead of bracket notation when possible
Prefer single quotes for strings (except when avoiding escapes)

Files:

  • packages/database-integrations/src/database-integration-env-vars.ts
packages/*/src/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Place source code under packages/*/src/

Files:

  • packages/database-integrations/src/database-integration-env-vars.ts
🧬 Code graph analysis (1)
packages/database-integrations/src/database-integration-env-vars.ts (4)
packages/database-integrations/src/database-integration-metadata-schemas.ts (1)
  • DatabaseIntegrationMetadataByType (268-270)
packages/database-integrations/src/sql-integration-auth-methods.ts (5)
  • FederatedAuthMethod (42-42)
  • isFederatedAuthMethod (44-46)
  • DatabaseAuthMethods (26-29)
  • AwsAuthMethods (1-4)
  • isFederatedAuthMetadata (48-52)
packages/database-integrations/src/sql-alchemy-types.ts (1)
  • SqlAlchemyInput (4-22)
packages/database-integrations/src/snowflake-integration-env-vars.ts (1)
  • getSnowflakeSqlAlchemyInput (6-46)
🔇 Additional comments (8)
packages/database-integrations/src/database-integration-env-vars.ts (8)

1-128: Well-structured foundation.

Type definitions, main function, and MongoDB/SQL helpers are clean. Good error aggregation pattern, safe URL manipulation with URLSearchParams, proper null handling for federated auth.


140-206: Solid dispatcher implementation.

Federated auth check at the top is correct, switch coverage is exhaustive with assertNever, and delegation pattern keeps each handler focused.


208-409: Integration handlers handle edge cases properly.

Databricks, Dremio, SQL Server, Postgres, Redshift, and Materialize handlers all encode credentials correctly, use consistent SSH options patterns, and the shared getPostgresStyleMode helper eliminates duplication. Redshift IAM handling is appropriately defensive.


456-483: Trino password encoding confirmed fixed.

Password, user, and database are all properly encoded. SSL and CA cert handling is clean.


516-573: ClickHouse implementation is solid.

Credentials properly encoded, URLSearchParams usage is safe, SSL/TLS handling is correct, and SSH options follow the established pattern.


575-641: Excellent error handling for BigQuery and Spanner.

Custom error classes with proper cause chaining, defensive projectId validation, and correct re-throw logic to preserve original errors. Both handle non-Error instances in catch blocks.


643-696: MySQL SSL handling is intentional.

Always enables SSL (either with CA verification or the documented enable: true hack). This appears deliberate given the detailed comment and lack of sslEnabled flag in MySQL metadata.


698-725: Utilities are correct and past issues confirmed fixed.

CA cert path construction is simple and safe. convertToEnvironmentVariableName follows POSIX spec with correct regex (no multiline flag). assertNever now uses local implementation instead of Zod internals.

@jankuca
jankuca enabled auto-merge (squash) November 1, 2025 12:30
@saltenasl
saltenasl requested a review from Artmann November 1, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants