Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clickhouse-buffer

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clickhouse-buffer - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

lib/retries.d.ts

4

lib/index.d.ts

@@ -6,2 +6,3 @@ import { ClickhouseClient } from "@watchdg/clickhouse-client";

import { CompressionFormat } from "./encoder_decoder";
import { IRetriesOptions } from "./retries";
interface Conditions {

@@ -27,5 +28,7 @@ maxTime?: number;

compressedFiles?: CompressionFormat;
retries?: IRetriesOptions;
}
type columnType = string | number | Date | boolean;
export declare class ClickhouseBuffer {
private readonly options;
private readonly directoryPath;

@@ -38,2 +41,3 @@ private readonly fsMode;

private readonly compressedFiles?;
private readonly retriesOptions;
private readonly maxRowsPerFile;

@@ -40,0 +44,0 @@ private readonly maxRowsInMemory;

41

lib/index.js

@@ -16,2 +16,3 @@ "use strict";

const mutex_1 = require("./mutex");
const retries_1 = require("./retries");
const encoder_decoder_2 = require("./encoder_decoder");

@@ -68,12 +69,27 @@ const rows_to_files_1 = require("./rows_to_files");

});
let stream = (0, files_to_stream_1.filesToStream)(Array.from(paths));
const encoder = (0, encoder_decoder_2.getEncoder)(self.compressed);
if (encoder) {
stream = stream.pipe(encoder);
}
await self.clickhouseClient.query({
query: self.insertStatement,
data: stream,
compressed: self.compressed
});
await (0, retries_1.withRetries)(self.retriesOptions, async function () {
let stream = (0, files_to_stream_1.filesToStream)(Array.from(paths));
const encoder = (0, encoder_decoder_2.getEncoder)(self.compressed);
if (encoder) {
stream = stream.pipe(encoder);
}
await self.clickhouseClient.query({
query: self.insertStatement,
data: stream,
compressed: self.compressed
});
}, null);
// let stream = filesToStream(Array.from(paths));
//
// const encoder = getEncoder(self.compressed);
//
// if (encoder) {
// stream = stream.pipe(encoder);
// }
//
// await self.clickhouseClient.query({
// query: self.insertStatement,
// data: stream,
// compressed: self.compressed
// });
await removeFiles(paths);

@@ -103,2 +119,3 @@ })

this.fsMode = 0o777;
this.retriesOptions = retries_1.DEFAULT_RETRIES_OPTIONS;
this.maxRowsPerFile = 1000;

@@ -113,2 +130,6 @@ this.maxRowsInMemory = 1000;

this.statsRowsInFiles = 0;
this.options = options;
if (options.retries) {
this.retriesOptions = options.retries;
}
if (options.maxRowsInMemory) {

@@ -115,0 +136,0 @@ this.maxRowsInMemory = options.maxRowsInMemory;

@@ -8,5 +8,5 @@ "use strict";

const process_1 = require("process");
const encoder_decoder_1 = require("./encoder_decoder");
const promises_1 = require("fs/promises");
const path_1 = __importDefault(require("path"));
const encoder_decoder_1 = require("./encoder_decoder");
function calculateBytes(rows) {

@@ -13,0 +13,0 @@ return rows.reduce(function (bytes, row) {

{
"name": "clickhouse-buffer",
"version": "2.1.0",
"version": "2.2.0",
"keywords": [
"clickhouse",
"database",
"buffer",
"client"
],
"license": "MIT",

@@ -23,3 +29,3 @@ "author": {

"dependencies": {
"@watchdg/clickhouse-client": "^1.14.0"
"@watchdg/clickhouse-client": "^1.15.0"
},

@@ -31,3 +37,3 @@ "devDependencies": {

"@typescript-eslint/parser": "^5.51.0",
"eslint": "^8.33.0",
"eslint": "^8.34.0",
"jest": "^29.4.2",

@@ -34,0 +40,0 @@ "rimraf": "^4.1.2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc