Registry / database / snowflake-orm

snowflake-orm

JSON →
library1.0.6jsnpmunverified

An ORM for Node.js and Snowflake DB that provides model-based table creation and CRUD operations. Version 1.0.6 is the latest stable release. It supports Snowflake-specific data types (VARCHAR, NUMBER, TIMESTAMP, etc.) and offers features like auto-generated unique keys, default values, and basic query building. Unlike general-purpose ORMs, it is tailored for Snowflake's lack of primary key enforcement and column-based storage. The package includes types for dynamic table creation and data retrieval with where clauses and column selection.

npm install snowflake-orm
INSTALL
IMPORT
SIG · SNOWFLAKE-ORM
S
snowflake-orm
databasejavascriptv1.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const snowflakeOrm = require('snowflake-orm');
import snowflakeOrm from 'snowflake-orm';
Package does not support ES modules; CommonJS require() is required.
Init
const SnowflakeOrm = require('snowflake-orm'); const Init = SnowflakeOrm.Init;
const { Init } = require('snowflake-orm');
Direct destructuring of Init may not work due to export structure; use dot property access after require().
VARCHAR
const SnowflakeOrm = require('snowflake-orm'); SnowflakeOrm.VARCHAR(50)
SnowflakeOrm.String(50)
DataType functions are called directly on the required object; no separate import needed.

Connects to Snowflake DB, defines a User model with unique ID, name, email, createdAt, creates the table, and queries rows where name is 'John'.

const snowflakeOrm = require('snowflake-orm'); const dbConfig = { account: process.env.SNOWFLAKE_ACCOUNT ?? '', username: process.env.SNOWFLAKE_USER ?? '', password: process.env.SNOWFLAKE_PASSWORD ?? '', warehouse: process.env.SNOWFLAKE_WAREHOUSE ?? '', database: process.env.SNOWFLAKE_DATABASE ?? '', schema: process.env.SNOWFLAKE_SCHEMA ?? '', role: process.env.SNOWFLAKE_ROLE ?? '' }; snowflakeOrm.connect(dbConfig); const Init = snowflakeOrm.Init; const User = new Init('users', { id: { type: snowflakeOrm.VARCHAR(50), require: true }, name: snowflakeOrm.VARCHAR(100), email: snowflakeOrm.VARCHAR(100), createdAt: { type: snowflakeOrm.TIMESTAMP('LTZ'), defaultValue: snowflakeOrm.NOW() } }); User.create() .then(() => User.find({ column: ['name', 'email'], where: { name: 'John' } })) .then(console.log) .catch(console.error);
Debug
Known issues
gotchaSnowflake does not support PRIMARY KEY or UNIQUE constraints; using them may cause errors or be silently ignored. The ORM includes them but they are not enforced by Snowflake.
fix
Avoid primaryKey and unique in schema; instead rely on require: true for unique auto-generated IDs.
affects: >=0.0.0
gotchaThe package is CommonJS only; attempting to import via ES modules (import/export) will fail.
fix
Use require('snowflake-orm') instead of import.
affects: >=1.0.0
gotchaThe connect() function does not return a connection object and may not support multiple connections; it uses a global singleton connection.
fix
Ensure connect() is called once before any model operations.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'snowflake-orm'
Package not installed or npm install failed.
fix
Run: npm install snowflake-orm
SnowflakeOrm.Init is not a constructor
Incorrect import syntax; Init is a property of the required module, not a separate export.
fix
Use: const Init = require('snowflake-orm').Init;
require() of ES Module not supported
Using import statement (ESM) in a Node environment that expects CommonJS or vice versa.
fix
Use const snowflakeOrm = require('snowflake-orm'); instead of import.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Meta
1
Resources
snowflake-orm — npm install snowflake-orm · libregistry