{"id":18940,"library":"ydb-sdk-lite","title":"ydb-sdk-lite","description":"ydb-sdk-lite v2.1.0 is a lightweight alternative to the official YDB Node.js SDK, optimized for low require time (~100ms vs 300ms) and small size (~5MB vs 40MB). Developed by Vitaliy Potapov, it supports DDL queries, automatic parameter type inference, and is designed for serverless environments. It currently only supports primitive types. The package ships TypeScript definitions and is released as needed.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/vitalets/ydb-sdk-lite","tags":["javascript","typescript"],"install":[{"cmd":"npm install ydb-sdk-lite","lang":"bash","label":"npm"},{"cmd":"yarn add ydb-sdk-lite","lang":"bash","label":"yarn"},{"cmd":"pnpm add ydb-sdk-lite","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Ydb is a named export, not default.","wrong":"import Ydb from 'ydb-sdk-lite'","symbol":"Ydb","correct":"import { Ydb } from 'ydb-sdk-lite'"},{"note":"CommonJS destructuring required for named export.","wrong":"const Ydb = require('ydb-sdk-lite')","symbol":"Ydb","correct":"const { Ydb } = require('ydb-sdk-lite')"},{"note":"Type import for TypeScript when only type is needed.","wrong":null,"symbol":"Ydb","correct":"import type { Ydb } from 'ydb-sdk-lite'"}],"quickstart":{"code":"import { Ydb } from 'ydb-sdk-lite';\n\nconst ydb = new Ydb({\n  dbName: 'your-database',\n  iamToken: process.env.YDB_TOKEN ?? '',\n  tablePathPrefix: 'your/path'\n});\n\n// Execute a simple query\nconst [users] = await ydb.executeDataQuery('SELECT * FROM users');\nconsole.log(users);\n\n// Execute with parameters\nconst query = `\n  DECLARE $userId AS Int32;\n  SELECT * FROM users WHERE userId = $userId;\n`;\nconst [user] = await ydb.executeDataQuery(query, { $userId: 42 });\nconsole.log(user);\n\n// Execute DDL\nawait ydb.executeYql('DROP TABLE IF EXISTS users');\n","lang":"typescript","description":"Creates a Ydb client, runs a parameterized query and a DDL statement."},"warnings":[{"fix":"Use only columns with primitive types or fall back to official ydb-sdk for complex types.","message":"Only primitive types are supported (Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64, Float, Double, String, Utf8, Bool, Date, Datetime, Timestamp). Complex types like Optional, List, Dict, Struct, Tuple are not supported.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use executeYql for DDL queries like CREATE TABLE, DROP TABLE, etc.","message":"executeDataQuery only works for DML queries (SELECT, INSERT, UPDATE, DELETE). DDL or other YQL statements must use executeYql.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If you need full YDB feature set, use the official ydb-sdk package.","message":"The package is lightweight and intended for serverless use. It may not handle all edge cases or large datasets as efficiently as the official SDK.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use const { Ydb } = require('ydb-sdk-lite') or import { Ydb } from 'ydb-sdk-lite' and then new Ydb(...).","cause":"Importing Ydb incorrectly: using a default import instead of named import, then trying to call it as a function without new.","error":"TypeError: Class constructor Ydb cannot be invoked without 'new'"},{"fix":"Only use primitive types; avoid Optional, List, Dict, etc., or switch to official ydb-sdk.","cause":"Query uses a complex type not supported by ydb-sdk-lite.","error":"Error: Unsupported type: Optional<...>"},{"fix":"Run npm install ydb-sdk-lite and ensure import path is correct.","cause":"Package not installed or typo in package name.","error":"Cannot find module 'ydb-sdk-lite'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}