@@ -359,6 +359,53 @@ suite('SqlIntegrationEnvironmentVariablesProvider', () => {
359359 const expectedEnvVarName = `SQL_${ DATAFRAME_SQL_INTEGRATION_ID . toUpperCase ( ) . replace ( / - / g, '_' ) } ` ;
360360 assert . ok ( result [ expectedEnvVarName ] , `Should have ${ expectedEnvVarName } env var for DuckDB` ) ;
361361 } ) ;
362+
363+ test ( 'Snowflake integration includes partner identifier in URL as application parameter' , async ( ) => {
364+ const resource = Uri . file ( '/test/notebook.deepnote' ) ;
365+ const notebook = mock < NotebookDocument > ( ) ;
366+ const snowflakeConfig : DatabaseIntegrationConfig = {
367+ id : 'my-snowflake' ,
368+ name : 'Snowflake DB' ,
369+ type : 'snowflake' ,
370+ metadata : {
371+ authMethod : 'password' ,
372+ accountName : 'test-account.us-east-1' ,
373+ warehouse : 'test_warehouse' ,
374+ database : 'test_db' ,
375+ role : 'test_role' ,
376+ username : 'test_user' ,
377+ password : 'test_pass'
378+ }
379+ } ;
380+ const project = createMockProject ( 'project-123' , [
381+ { id : 'my-snowflake' , name : 'Snowflake DB' , type : 'snowflake' }
382+ ] ) ;
383+
384+ when ( notebook . metadata ) . thenReturn ( { deepnoteProjectId : 'project-123' } ) ;
385+ when ( notebookEditorProvider . findAssociatedNotebookDocument ( resource ) ) . thenReturn ( instance ( notebook ) ) ;
386+ when ( notebookManager . getOriginalProject ( 'project-123' ) ) . thenReturn ( project ) ;
387+ when ( integrationStorage . getIntegrationConfig ( 'my-snowflake' ) ) . thenResolve ( snowflakeConfig ) ;
388+
389+ const result = await provider . getEnvironmentVariables ( resource ) ;
390+
391+ const expectedEnvVarName = 'SQL_MY_SNOWFLAKE' ;
392+ assert . ok ( result [ expectedEnvVarName ] , `Should have ${ expectedEnvVarName } env var` ) ;
393+
394+ const envVarValue = result [ expectedEnvVarName ] ;
395+ assert . ok ( typeof envVarValue === 'string' , 'Env var value should be a string' ) ;
396+ assert . ok ( envVarValue , 'Env var value should not be undefined' ) ;
397+
398+ // Parse and verify the structure
399+ const parsed = JSON . parse ( envVarValue ! ) ;
400+ assert . ok ( parsed . url , 'Should have url field' ) ;
401+ assert . ok ( parsed . url . includes ( 'snowflake://' ) , 'URL should be Snowflake connection string' ) ;
402+
403+ // Verify that the application parameter is set to the Snowflake partner identifier
404+ assert . ok (
405+ parsed . url . includes ( 'application=Deepnote_Workspaces' ) ,
406+ 'URL should contain application=Deepnote_Workspaces parameter'
407+ ) ;
408+ } ) ;
362409 } ) ;
363410 } ) ;
364411
0 commit comments