Edits history of script submission #5925 for ' Load a preview of a parquet file (windmill)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    /**
     * 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

  • nativets
    /**
     * 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