Skip to content

Commit d1e8f49

Browse files
committed
prevent saving and loading of duckdb integrations via integration storage
1 parent 392f52c commit d1e8f49

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/platform/notebooks/deepnote/integrationStorage.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { IIntegrationStorage } from './types';
88
import { upgradeLegacyIntegrationConfig } from './legacyIntegrationConfigUtils';
99
import {
1010
DatabaseIntegrationConfig,
11-
DatabaseIntegrationType,
1211
databaseIntegrationTypes,
1312
databaseMetadataSchemasByType
1413
} from '@deepnote/database-integrations';
14+
import { DATAFRAME_SQL_INTEGRATION_ID } from './integrationTypes';
1515

1616
const INTEGRATION_SERVICE_NAME = 'deepnote-integrations';
1717

@@ -81,6 +81,11 @@ export class IntegrationStorage implements IIntegrationStorage {
8181
* Save or update an integration configuration
8282
*/
8383
async save(config: DatabaseIntegrationConfig): Promise<void> {
84+
if (config.type === 'pandas-dataframe' || config.id === DATAFRAME_SQL_INTEGRATION_ID) {
85+
logger.warn(`IntegrationStorage: Skipping save for internal DuckDB integration ${config.id}`);
86+
return;
87+
}
88+
8489
await this.ensureCacheLoaded();
8590

8691
// Store the configuration as JSON in encrypted storage
@@ -165,6 +170,10 @@ export class IntegrationStorage implements IIntegrationStorage {
165170

166171
// Load each integration configuration
167172
for (const id of integrationIds) {
173+
if (id === DATAFRAME_SQL_INTEGRATION_ID) {
174+
continue;
175+
}
176+
168177
const configJson = await this.encryptedStorage.retrieve(INTEGRATION_SERVICE_NAME, id);
169178
if (configJson) {
170179
try {
@@ -178,6 +187,11 @@ export class IntegrationStorage implements IIntegrationStorage {
178187
const upgradedConfig = await upgradeLegacyIntegrationConfig(parsedData);
179188

180189
if (upgradedConfig) {
190+
if (upgradedConfig.type === 'pandas-dataframe') {
191+
logger.warn(`IntegrationStorage: Skipping internal DuckDB integration ${id}`);
192+
continue;
193+
}
194+
181195
// Successfully upgraded - save the new config
182196
logger.info(`Successfully upgraded integration config for ${id}`);
183197
await storeEncryptedIntegrationConfig(this.encryptedStorage, id, {
@@ -193,9 +207,11 @@ export class IntegrationStorage implements IIntegrationStorage {
193207
} else {
194208
// Already versioned config - validate against current schema
195209
const { version: _version, ...rawConfig } = parsedData;
196-
const config = databaseIntegrationTypes.includes(rawConfig.type)
197-
? (rawConfig as DatabaseIntegrationConfig)
198-
: null;
210+
const config =
211+
databaseIntegrationTypes.includes(rawConfig.type) &&
212+
rawConfig.type !== 'pandas-dataframe'
213+
? (rawConfig as DatabaseIntegrationConfig)
214+
: null;
199215
const validMetadata = config
200216
? databaseMetadataSchemasByType[config.type].safeParse(config.metadata).data
201217
: null;

0 commit comments

Comments
 (0)