/**
* Load a preview of a parquet file
*
*/
export async function main(
workspace: string,
path: string,
offset: string | undefined,
limit: string | undefined,
sort_col: string | undefined,
sort_desc: string | undefined,
search_col: string | undefined,
search_term: string | undefined
) {
const url = new URL(
`${BASE_URL}/api/w/${workspace}/job_helpers/load_parquet_preview/${path}`
);
for (const [k, v] of [
["offset", offset],
["limit", limit],
["sort_col", sort_col],
["sort_desc", sort_desc],
["search_col", search_col],
["search_term", search_term],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + WM_TOKEN,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 370 days ago
/**
* Load a preview of a parquet file
*
*/
export async function main(
workspace: string,
path: string,
offset: string | undefined,
limit: string | undefined,
sort_col: string | undefined,
sort_desc: string | undefined,
search_col: string | undefined,
search_term: string | undefined
) {
const url = new URL(
`${BASE_URL}/api/w/${workspace}/job_helpers/load_parquet_preview/${path}`
);
for (const [k, v] of [
["offset", offset],
["limit", limit],
["sort_col", sort_col],
["sort_desc", sort_desc],
["search_col", search_col],
["search_term", search_term],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + WM_TOKEN,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 797 days ago