Git Product home page Git Product logo

ydb-sdk-lite's Introduction

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

ydb-sdk-lite's People

Contributors

vitalets avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ydb-sdk-lite's Issues

Не работает

Я установил ydb-sdk-lite, импортировал функции.
Создал константу ydb с именем базы и моим токеном.
Выполняю ydb.executeDataQuery('DROP TABLE users'); и вылетает ошибка
node_modules@grpc\grpc-js\src\call.ts:82
const error = new Error(message);
^ (new)
Error: 5 NOT_FOUND: NotFound

Я использую node.js, а запускаю через npm run start (nodemon --exec ts-node src/app.ts)

Я уже перепробовал все...

I installed ydb-sdk-lite, imported the functions.
I created a ydb constant with the name of the database and my token.
I execute ydb.executeDataQuery('DROP TABLE users'); and an error occurs
node_modules@grpc\grpc-js\src\call.ts:82
const error = new Error(message);
^ (new)
Error: 5 NOT_FOUND: NotFound

I'm using node.js and running it via npm run start (nodemon --exec ts-node src/app.ts)

I've already tried everything...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.