npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@db2lake/core

v0.2.0

Published

Core interfaces and utilities for db2lake

Readme

@db2lake/core

Introduction

db2lake is a small framework for extracting data from databases and loading it into data lakes and warehouses. It provides a tiny, stable core API and a set of driver packages (sources and destinations). Drivers can be scheduled and resumed using cursor information so that only new data is transferred on subsequent runs.

This repository is a monorepo that includes the core package plus multiple source and destination drivers.

Learn more about db2lake in our post on Dev.to: Introducing db2lake: A Lightweight and Powerful ETL Framework for Node.js

Install

Install the core package:

npm install @db2lake/core

Source drivers

| Purpose | Driver | Install | |---|:---|---| | MySQL | @db2lake/driver-mysql | npm i @db2lake/driver-mysql | | Firestore | @db2lake/driver-firestore | npm i @db2lake/driver-firestore | | Postgres | @db2lake/driver-postgres | npm i @db2lake/driver-postgres | | Oracle | @db2lake/driver-oracle | npm i @db2lake/driver-oracle |

Destination drivers

| Purpose | Driver | Install | |---|:---|---| | BigQuery | @db2lake/driver-bigquery | npm i @db2lake/driver-bigquery | | Databricks | @db2lake/driver-databricks | npm i @db2lake/driver-databricks | | Redshift | @db2lake/driver-redshift | npm i @db2lake/driver-redshift | | Snowflake | @db2lake/driver-snowflake | npm i @db2lake/driver-snowflake |

Quick install example

Install the core plus the MySQL source and BigQuery destination (example):

npm install @db2lake/core @db2lake/driver-mysql @db2lake/driver-bigquery

Complete TypeScript example

The following example demonstrates a simple pipeline using the MySQL source driver and the BigQuery destination driver. It uses a transformer to adapt the source rows and a lightweight logger passed into the pipeline.

Save as examples/mysql-to-bigquery.ts and run with ts-node or compile with tsc.

import { Pipeline, ITransformer, ILogger } from '@db2lake/core';
import { MySQLSourceDriver } from '@db2lake/driver-mysql';
import { BigQueryDestinationDriver } from '@db2lake/driver-bigquery';

// --- Configure drivers (fill with your credentials) ---
const mysqlConfig = {
    query: 'SELECT * FROM orders WHERE order_id > ? LIMIT 50',
    params: [0],
    cursorField: 'order_id',
    cursorParamsIndex: 0,
    connectionUri: 'mysql://user:password@localhost:3306/shopdb'
};

const bigqueryConfig = {
    bigQueryOptions: {
        keyFilename: './service-account.json',
        projectId: 'my-project-id'
    },
    dataset: 'my_dataset',
    table: 'users',
    batchSize: 1000,
    // Optional: use streaming for real-time inserts
    writeOptions: {
        sourceFormat: 'NEWLINE_DELIMITED_JSON'
    }
};

// --- Transformer: adapt source row shape to destination schema ---
const transformer: ITransformer<any, any> = (rows) => rows.map(r => ({
	id: r.id,
	fullName: `${r.name}`,
	createdAt: r.created_at instanceof Date ? r.created_at.toISOString() : r.created_at
}));

// --- Logger ---
const logger: ILogger = (level, message, data) => {
	const ts = new Date().toISOString();
	console.log(`${ts} [${level.toUpperCase()}] ${message}`);
	if (data) console.debug(data);
};

async function main() {
	const source = new MySQLSourceDriver(mysqlConfig as any);
	const dest = new BigQueryDestinationDriver(bigqueryConfig as any);

	const pipeline = new Pipeline(source as any, dest as any, transformer, logger);

	try {
		await pipeline.run();
		console.log('Pipeline finished', pipeline.getMetrics());
	} catch (err) {
		console.error('Pipeline error', err);
	}
}

main().catch(err => { console.error(err); process.exit(1); });

Contributing

PRs that add drivers or improve the core API are welcome. Try to keep the core API minimal and well-documented so drivers remain simple to implement.

License

MIT