Repository navigation
feat: add database-integrations package (types + env vars) - #70
Conversation
📝 WalkthroughWalkthroughAdds 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
Possibly related PRs
Suggested reviewers
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Comment |
There was a problem hiding this comment.
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.
📒 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.tspackages/sql-integrations/src/sql-structure-utils.tspackages/sql-integrations/src/sql-validation-schemas.tspackages/sql-integrations/src/sql-integrations-config.tspackages/sql-integrations/src/sql-structure-constants.tspackages/sql-integrations/src/sql-constants.tspackages/sql-integrations/src/sql-code-samples.tspackages/sql-integrations/src/sql-auth-methods.tspackages/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.tspackages/sql-integrations/src/sql-structure-utils.tspackages/sql-integrations/src/sql-validation-schemas.tspackages/sql-integrations/src/sql-integrations-config.tspackages/sql-integrations/src/sql-structure-constants.tspackages/sql-integrations/src/sql-constants.tspackages/sql-integrations/src/sql-code-samples.tspackages/sql-integrations/src/sql-auth-methods.tspackages/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.tspackages/sql-integrations/src/sql-structure-utils.tspackages/sql-integrations/src/sql-validation-schemas.tspackages/sql-integrations/src/sql-integrations-config.tspackages/sql-integrations/src/sql-structure-constants.tspackages/sql-integrations/src/sql-constants.tspackages/sql-integrations/src/sql-code-samples.tspackages/sql-integrations/src/sql-auth-methods.tspackages/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 constand 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: Useimport typefor 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.
b5b6517 to
cd847bb
Compare
There was a problem hiding this comment.
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.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.tspackages/sql-integrations/src/sql-integration-auth-methods.tspackages/sql-integrations/src/sql-integration-metadata-types.tspackages/sql-integrations/src/index.tspackages/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.tspackages/sql-integrations/src/sql-integration-auth-methods.tspackages/sql-integrations/src/sql-integration-metadata-types.tspackages/sql-integrations/src/index.tspackages/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.tspackages/sql-integrations/src/sql-integration-auth-methods.tspackages/sql-integrations/src/sql-integration-metadata-types.tspackages/sql-integrations/src/index.tspackages/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, allowingnull | 'service-account'. This is unusual. Verify if this is intentional or if the entire object should be optional instead.If
nullis 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
portasstringrather thannumber. Verify this is intentional for serialization, or usenumberfor type safety.
145-146: Test function ensures exhaustive type coverage.The compile-time test correctly verifies that
IntegrationMetadataByTypekeys matchSqlIntegrationType. 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-dataframeis already present insqlIntegrationTypes(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.
cd847bb to
8edfb2e
Compare
There was a problem hiding this comment.
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
BigQueryAuthMethodsat runtime by marking ittype, soBigQueryAuthMethods.ServiceAccountthrows. 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.
📒 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.tspackages/sql-integrations/src/sql-integration-auth-methods.tspackages/sql-integrations/src/sql-integration-types.tspackages/sql-integrations/src/sql-integration-metadata-types.tspackages/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.tspackages/sql-integrations/src/sql-integration-auth-methods.tspackages/sql-integrations/src/sql-integration-types.tspackages/sql-integrations/src/sql-integration-metadata-types.tspackages/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.tspackages/sql-integrations/src/sql-integration-auth-methods.tspackages/sql-integrations/src/sql-integration-types.tspackages/sql-integrations/src/sql-integration-metadata-types.tspackages/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.
Artmann
left a comment
There was a problem hiding this comment.
Looks good overall, just left a few small comments :)
| "editor.formatOnSave": true, | ||
| "biome.enabled": true | ||
| "biome.enabled": true, | ||
| "typescript.tsdk": "node_modules/typescript/lib" |
|
|
||
| export type SqlIntegrationConfig = Extract<DatabaseIntegrationConfig, { type: SqlIntegrationType }> | ||
|
|
||
| export function getIntegrationListEnv( |
There was a problem hiding this comment.
Can we come up with a better name for this? Something like listEnvironmentVariablesForIntegrations?
There was a problem hiding this comment.
I wanted the name to be a bit more concise. I started with getIntegrationListEnvironmentVariables.
There was a problem hiding this comment.
agree with @Artmann I did not understand that this returns environment variables from the original name
| ): { | ||
| envVars: Array<EnvVar> | ||
| errors: Array<Error> | ||
| } { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
You are actually commenting on a return type. Is there an exported function that does not have it?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
I didn't know you could do this 😅 Nice!
0c9d1be
0c9d1be to
c1c7e1b
Compare
|
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. |
There was a problem hiding this comment.
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.
📒 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.tspackages/database-integrations/src/database-integration-env-vars.tspackages/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.tspackages/database-integrations/src/database-integration-env-vars.tspackages/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.tspackages/database-integrations/src/database-integration-env-vars.tspackages/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)
There was a problem hiding this comment.
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.
📒 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
getPostgresStyleModehelper 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: truehack). This appears deliberate given the detailed comment and lack ofsslEnabledflag in MySQL metadata.
698-725: Utilities are correct and past issues confirmed fixed.CA cert path construction is simple and safe.
convertToEnvironmentVariableNamefollows POSIX spec with correct regex (no multiline flag).assertNevernow uses local implementation instead of Zod internals.

Summary by CodeRabbit