Skip to content

Cant get all the results of a query execute #43

Description

@314gui

Hi guys,
I'm trying to get all the results from a query but today I noticed that sometimes it wouldn't return all the rows. After reading the docs I understand that the data attribute from client.execute function can be called 2 or more times and that's why my code is wrong.

executePrestoQuery(query: string): Promise<any> {
    return new Promise<any>((resolve, reject) => {
      this.client.execute({
        query: query,
        catalog: "hive",
        schema: "default",
        source: "nodejs-client",
        data: function (error, data, columns, stats) {
          resolve(data);
        },
        success: function (error, stats, info) {
          console.log("success");
        },
        error: function (error) {
          reject(error);
        },
      });
    });
  }

So said that what's the best way to return all the data from the client.execute function? Can I return the data on the success attribute?

(Sorry If it's an easy solution I am new to Javascript)
Thank you
Guilherme

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions