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

db2-random-data-1

v1.0.1

Published

db2 generator ddlgenerator

Readme

Db2 12.1.2 random test-data inserter

这个工具读取一个表名和数据量列表,向指定 schema 下的表插入随机数据。

直接执行

列表文件格式:

CUSTOMER,100
ORDERS,200
PRODUCT,50

执行前准备好 Db2 CLP 和数据库连接环境,然后传入 schema 和列表文件:

chmod +x random_insert.sh
./random_insert.sh APP list.txt

通过 npm 全局安装后也可以执行:

db2-random-data APP list.txt

脚本安装过程一次、设置 schema 一次、逐行插入,最后提交。

不需要在 Docker 容器内执行。只要运行脚本的机器具有 Db2 CLP,它可以连接本机 或远程 DB2。Docker 只是开发阶段可选的测试数据库。

Implemented mapping

| Db2 type | Generated value | | --- | --- | | CHAR, CHARACTER, VARCHAR | random ASCII digit string, bounded by SYSCAT.COLUMNS.LENGTH | | DECIMAL, NUMERIC | random value derived from precision (LENGTH) and SCALE, with an overflow safety margin | | integer and floating numeric types | random value within a conservative type-safe range | | DATE | CURRENT DATE | | TIMESTAMP | CURRENT TIMESTAMP | | BLOB | fixed X'ABCD1234' bytes | | any other type | NULL |

Identity and generated columns are omitted from the insert list. Inserts use a single recursive-CTE INSERT ... SELECT except for the rare table containing only generated columns.

Expected limitations

This is type-aware rather than business-aware. Foreign keys, unique keys, check constraints, triggers, row/column access control, and unsupported NOT NULL columns can still reject the insert. Very large DATACOUNT values also create a large transaction; commit batching is intentionally not hidden inside the procedure.

SQL PL 已依据 IBM Db2 12.1 文档检查;当前版本没有在真实 Db2 12.1.2 实例中 执行过,首次在目标环境运行前应先对测试表进行一次 smoke test。

Excel DDL 生成模块

1.0.1 开始,包内附带纯文本文件:

DDLGenerator_import.txt

该文件本身不是带宏的 Excel 文件,也不会自行执行。目标电脑上的使用步骤:

  1. DDLGenerator_import.txt 改名为 DDLGenerator.bas
  2. 打开目标 Excel 文件,按 Alt + F11 进入 Visual Basic Editor。
  3. 选择 FileImport File...,导入 DDLGenerator.bas
  4. 在 Excel 中定义三个工作簿级名称:
    • TargetTableHeader:目标表名表头单元格。
    • DDLTemplate:DDL 模板所在单元格。
    • OutputFolder:输出目录所在单元格。
  5. 在模板中使用 {{TABLE_NAME}} 作为表名占位符。
  6. 将按钮分别绑定到 SelectOutputFolderGenerateDDLFiles
  7. 将工作簿另存为启用宏的 .xlsm 文件。

文本当前使用 UTF-8。传统 VBE 导入包含日文等非 ASCII 字符的模块时仍可能受到 Windows 系统区域和文本编码影响;出现乱码时,先在目标电脑上将文本另存为 ANSI(日文 Windows 通常为 CP932/Shift_JIS)后,再改名为 .bas 并导入。