ydb-sdk-lite
v2.1.0
Published
Lightweight implementation of Yandex Database SDK for Node.js
Downloads
83
Readme
ydb-sdk-lite
Lightweight implementation of ydb-sdk for Node.js. Mainly for usage in serverless functions.
Features
- Fast require time (100ms vs 300ms)
- Small size (5Mb vs 40Mb)
- DDL queries support
- Infer parameters type by query text
Limitations
- Only primitive types supported
Installation
npm i ydb-sdk-lite
Usage
const { Ydb } = require('ydb-sdk-lite');
// create Ydb client
const ydb = new Ydb({ dbName: 'xxx', iamToken: 'yyy', tablePathPrefix: 'zzz' });
// execute single query (DML only)
const [ users ] = await ydb.executeDataQuery('SELECT * FROM users');
// execute single query with params
const query = `
DECLARE $userId AS int32;
SELECT * FROM users WHERE userId = $userId;
`;
const [ users ] = await ydb.executeDataQuery(query, { $userId: 42 });
// execute any YQL (DDL + DML)
await ydb.executeYql('DROP TABLE users');
Full example of using ydb-sdk-lite
in serverless function.
API Reference
tbd
License
MIT @ Vitaliy Potapov