
Security News
npm Tooling Bug Incorrectly Marks One-Character Packages as Security Holders
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.
@deepnote/database-integrations
Advanced tools
The database-integrations package defines the Deepnote database integrations.
This package provides TypeScript types and utilities for working with Deepnote SQL block integrations and other database integrations, including:
pandas-dataframe)athena)redshift)clickhouse)databricks)dremio)alloydb)big-query)spanner)mariadb)materialize)sql-server)mindsdb)mongodb)mysql)pgsql)snowflake)trino)type DatabaseIntegrationType – All supported database integration typestype DatabaseIntegrationTypeWithSslSupport – Database integration types that support SSL (subset of DatabaseIntegrationType)type SqlIntegrationType – SQL integration types (subset of DatabaseIntegrationType), excludes mongodbdatabaseIntegrationTypes – Array of all supported database integration types (DatabaseIntegrationType[])databaseIntegrationTypesWithSslSupport – Array of all database integration types that support SSL (DatabaseIntegrationTypeWithSslSupport[])sqlIntegrationTypes – Array of all SQL integration types (SqlIntegrationType[])databaseMetadataSchemasByType – Zod schemas for validating integration metadata by integration type
databaseMetadataSchemasByType['big-query'].safeParse({ ... })
type DatabaseIntegrationMetadataByType – Integration metadata types by integration type
const metadata: DatabaseIntegrationMetadataByType['big-query'] = { ... }
getEnvironmentVariablesForIntegrations(integrations: Array<DatabaseIntegrationConfig>, params: { projectRootDirectory: string, snowflakePartnerIdentifier?: string }) – Creates a list of environment variables to be set when executing a notebook that uses the integrations, the variables are in a format consumed by the Deepnote Toolkit
integrations – list of active integrationsparams.projectRootDirectory – project root directory, used to construct paths to CA certificatesparams.snowflakePartnerIdentifier (optional) – Snowflake partner identifier, used to construct Snowflake connection URLs; it is used for Snowflake's internal telemetry/analytics, it does not affect the functionality of the integrationenvVars: Array<EnvVar> – List of environment variables to be set when executing a notebook that uses the integrations
*INTEGRATION_NAME*_*METADATA_KEY* - for each metadata field of the integrationSQL_*INTEGRATION_ID* - SQL Alchemy config for each SQL integrationerrors: Array<Error> – List of errors that occurred when generating the environment variables. These are not thrown to allow partial functionality, even when some integrations are misconfigured.getSqlAlchemyInput(sqlIntegration: SqlIntegrationConfig, params: { projectRootDirectory: string, snowflakePartnerIdentifier?: string }) – Creates a SQL Alchemy config for a SQL integration, used to connect to the database from SQL blocks. This is used internally within getEnvironmentVariablesForIntegrations().
sqlIntegration – SQL integration configurationparams.projectRootDirectory – project root directory, used to construct paths to CA certificatesparams.snowflakePartnerIdentifier (optional) – see aboveSqlAlchemyInput | null – SQL Alchemy config for the integration, null when the integration has federated authenticationBigQueryServiceAccountParseError – when parsing BigQuery service account failsSpannerServiceAccountParseError – when parsing Spanner service account failstype DatabaseIntegrationConfig – Configuration for an integration when generating environment variables
type – integration typeid – integration ID (usually UUID)name – integration namemetadata – integration metadatafederated_auth_method (optional) – federated authentication method, used only when the integration has federated authentication enabled. The auth method configured via the metadata is also checked, these should match.type SqlIntegrationConfig – Configuration for a SQL integration when generating environment variables (subset of DatabaseIntegrationConfig, excluding non-SQL integrations)type SqlAlchemyInput - SQL Alchemy config for a SQL integrationBigQueryServiceAccountParseError – When parsing BigQuery service account fails
cause: Error – The original errorSpannerServiceAccountParseError – When parsing Spanner service account fails
cause: Error – The original errorThese values can be used to configure the integrations that have multiple methods for authentication.
type DatabaseAuthMethod – Authentication method for a database integrationtype AwsAuthMethod – Authentication method for an AWS integrationtype BigQueryAuthMethod – Authentication method for a BigQuery integrationtype SnowflakeAuthMethod – Authentication method for a Snowflake integrationtype FederatedAuthMethod – Authentication method for a federated authentication integrationAwsAuthMethods – All supported AWS authentication methodsBigQueryAuthMethods – All supported BigQuery authentication methodsDatabaseAuthMethods – All supported database authentication methodsSnowflakeAuthMethods – All supported Snowflake authentication methodsfederatedAuthMethods – All supported federated authentication methodsimport { databaseIntegrationTypes } from "@deepnote/database-integrations";
console.log(databaseIntegrationTypes); // ['athena', 'redshift', …]
import { databaseMetadataSchemasByType } from "@deepnote/database-integrations";
const validationResult = databaseMetadataSchemasByType["big-query"].safeParse({
authMethod: BigQueryAuthMethods.ServiceAccount,
service_account: "my-account",
});
if (validationResult.error) {
console.error(validationResult.error);
}
import { getEnvironmentVariablesForIntegrations } from "@deepnote/database-integrations";
const integrations = [
{
type: "pgsql",
id: "my-postgres",
name: "My PostgreSQL Integration",
metadata: {
host: "my-host",
user: "my-user",
password: "my-password",
database: "my-database",
},
},
];
const { envVars } = getEnvironmentVariablesForIntegrations(integrations, {
projectRootDirectory: "/path/to/project",
});
// envVars = [
// { name: "INTEGRATION_MY_POSTGRES_HOST", value: "my-host" },
// { name: "INTEGRATION_MY_POSTGRES_USER", value: "my-user" },
// { name: "INTEGRATION_MY_POSTGRES_PASSWORD", value: "my-password" },
// { name: "INTEGRATION_MY_POSTGRES_DATABASE", value: "my-database" },
// { name: "SQL_MY_POSTGRES", value: '{"url": "postgresql://my-user:my-password@my-host/my-database", "params": {}, "param_style": "pyformat"}' },
// ]
import {
type DatabaseIntegrationMetadataByType,
type DatabaseIntegrationType,
} from "@deepnote/database-integrations";
const myIntegrationDocsLinks: Record<
DatabaseIntegrationType,
{ docsLink: string }
> = {
"big-query": { docsLink: "https://example.com/my-docs/bq" },
// …
};
SQL block execution (set up in @deepnote/blocks) picks the environment variables and passes them to the Deepnote Toolkit (_dntk.execute_sql())
MongoDB is not a SQL integration, it is not used via SQL blocks but rather via code blocks and pymongo.
import os
from pymongo import MongoClient
# Connect to MongoDB using the connection string from environment variables
client = MongoClient(os.environ["INTEGRATION_NAME_CONNECTION_STRING"])
db = client[os.environ["INTEGRATION_NAME_DATABASE"]]
# Get the users collection
users_collection = db["users"]
# Find all documents in the users collection
users = list(users_collection.find())
Note: The INTEGRATION_NAME_ prefix of the env variables is constructed using the following logic.
Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore) from the characters defined in the Portable Character Set and do not begin with a digit.
import re
def convert_to_environment_variable_name(integration_name: str) -> str:
without_first_digit = f"_{integration_name}" if re.match(r'^\d', integration_name) else integration_name
upper_cased = without_first_digit.upper()
return re.sub(r'[^\w]', '_', upper_cased)
FAQs
Deepnote database integration definitions
The npm package @deepnote/database-integrations receives a total of 469 weekly downloads. As such, @deepnote/database-integrations popularity was classified as not popular.
We found that @deepnote/database-integrations demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.

Research
/Security News
Newer packages in this compromise use native extensions and .pth loaders to execute JavaScript stealers in developer environments.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.