import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.0.1/mod.ts";
import {
ClickHouseSettings,
createClient,
DataFormat,
QueryParams,
} from "npm:@clickhouse/client@0.0.10";
/**
* @param parse_into Name of the method that should be used to parse the results.
*
* @param format Format of the resulting dataset. Wrap the format name with `"` in the
* argument editor.
*
* @param clickhouse_settings ClickHouse settings that can be applied on query level.
*
* @param query_params Parameters for query binding.
*
* @param query_params AbortSignal instance to cancel a query in progress.
*/
type Clickhouse = {
host: string;
username: string;
password: string;
};
export async function main(
auth: Clickhouse,
query: string,
parse_into: "json" | "text" = "json",
format?: DataFormat,
clickhouse_settings?: ClickHouseSettings,
query_params?: Record<string, unknown>,
abort_signal?: AbortSignal,
) {
const client = createClient(removeObjectEmptyFields(auth));
const params = removeObjectEmptyFields({
query,
format,
clickhouse_settings,
query_params,
abort_signal,
}) as QueryParams;
const result = await client.query(params);
await client.close();
return await result[parse_into]();
}
Submitted by admin 466 days ago
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.0.1/mod.ts";
import { ClickHouseSettings, createClient, DataFormat, QueryParams } from "npm:@clickhouse/client@0.0.10"
/**
* @param parse_into Name of the method that should be used to parse the results.
*
* @param format Format of the resulting dataset. Wrap the format name with `"` in the
* argument editor.
*
* @param clickhouse_settings ClickHouse settings that can be applied on query level.
*
* @param query_params Parameters for query binding.
*
* @param query_params AbortSignal instance to cancel a query in progress.
*/
type Clickhouse = {
host: string;
username: string;
password: string;
};
export async function main(
auth: Clickhouse,
query: string,
parse_into: 'json' | 'text' = 'json',
format?: DataFormat,
clickhouse_settings?: ClickHouseSettings,
query_params?: Record<string, unknown>,
abort_signal?: AbortSignal,
) {
const client = createClient(removeObjectEmptyFields(auth))
const params = removeObjectEmptyFields({
query,
format,
clickhouse_settings,
query_params,
abort_signal,
}) as QueryParams
const result = await client.query(params)
await client.close()
return await result[parse_into]()
}
Submitted by admin 470 days ago
import { Resource } from "https://deno.land/x/windmill@v1.85.0/mod.ts"
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.0.1/mod.ts";
import { ClickHouseSettings, createClient, DataFormat, QueryParams } from "npm:@clickhouse/client@0.0.10"
/**
* @param parse_into Name of the method that should be used to parse the results.
*
* @param format Format of the resulting dataset. Wrap the format name with `"` in the
* argument editor.
*
* @param clickhouse_settings ClickHouse settings that can be applied on query level.
*
* @param query_params Parameters for query binding.
*
* @param query_params AbortSignal instance to cancel a query in progress.
*/
export async function main(
auth: Resource<'clickhouse'>,
query: string,
parse_into: 'json' | 'text' = 'json',
format?: DataFormat,
clickhouse_settings?: ClickHouseSettings,
query_params?: Record<string, unknown>,
abort_signal?: AbortSignal,
) {
const client = createClient(removeObjectEmptyFields(auth))
const params = removeObjectEmptyFields({
query,
format,
clickhouse_settings,
query_params,
abort_signal,
}) as QueryParams
const result = await client.query(params)
await client.close()
return await result[parse_into]()
}
Submitted by adam186 598 days ago
import { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts"
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.0.1/mod.ts";
import { ClickHouseSettings, createClient, DataFormat, QueryParams } from "npm:@clickhouse/client@0.0.10"
/**
* @param parse_into Name of the method that should be used to parse the results.
*
* @param format Format of the resulting dataset. Wrap the format name with `"` in the
* argument editor.
*
* @param clickhouse_settings ClickHouse settings that can be applied on query level.
*
* @param query_params Parameters for query binding.
*
* @param query_params AbortSignal instance to cancel a query in progress.
*/
export async function main(
auth: Resource<'clickhouse'>,
query: string,
parse_into: 'json' | 'text' = 'json',
format?: DataFormat,
clickhouse_settings?: ClickHouseSettings,
query_params?: Record<string, unknown>,
abort_signal?: AbortSignal,
) {
const client = createClient(removeObjectEmptyFields(auth))
const params = removeObjectEmptyFields({
query,
format,
clickhouse_settings,
query_params,
abort_signal,
}) as QueryParams
const result = await client.query(params)
await client.close()
return await result[parse_into]()
}
Submitted by adam186 633 days ago
import { Resource } from "https://deno.land/x/windmill@v1.57.1/mod.ts"
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.0.1/mod.ts";
import { ClickHouseSettings, createClient, DataFormat, QueryParams } from "npm:@clickhouse/client@0.0.10"
/**
* @param parse_into Name of the method that should be used to parse the results.
*
* @param format Format of the resulting dataset. Wrap the format name with `"` in the
* argument editor.
*
* @param clickhouse_settings ClickHouse settings that can be applied on query level.
*
* @param query_params Parameters for query binding.
*
* @param query_params AbortSignal instance to cancel a query in progress.
*/
export async function main(
auth: Resource<'clickhouse'>,
query: string,
parse_into: 'json' | 'text' = 'json',
format?: DataFormat,
clickhouse_settings?: ClickHouseSettings,
query_params?: Record<string, unknown>,
abort_signal?: AbortSignal,
) {
const client = createClient(removeObjectEmptyFields(auth))
const params = removeObjectEmptyFields({
query,
format,
clickhouse_settings,
query_params,
abort_signal,
}) as QueryParams
const result = await client.query(params)
await client.close()
return await result[parse_into]()
}
Submitted by adam186 690 days ago