API to retrieve data from dataset

Hi,

Is there a possibility to retrieve data from dataset via API? I came across this call
http://localhost:9047/apiv2/job/{id}
But, how to know the id of the job. For my use case, I have 5 tables which we could find via the catalog/by-path but each of these has a different job id. So, without knowing upfront the id of the job, is there a possibility to retrieve the data?
Or if there is a syntax in creating the ID before querying the API, I could pass it to the job as well.

Please let me know.

Thanks.

Kind Regards,
Ajay

You can use http://docs.dremio.com/rest-api/jobs/ to run jobs and get results. You could runs select * query for example.

Hi Doron,

thanks for the reply. To run the query also, I need the id of the JOB? So, my question is without knowing upfront the Id of the JOB, I would like to run the query on a dataset.

Thanks.

Kind Regards,
Ajay

The SQL API (http://docs.dremio.com/rest-api/sql/post-sql.html) will return a job id for you, I forgot to post that link earlier.

Thanks a lot Doron. I was able to retrieve the data now. My 2cents input, would be nice if we could get the data without a two step process. I feel creating the id of the job is an internal detail. As an user, I would like to get the data of the dataset via path. Anyways, to generate the JobID, I need the path right? So, why not having a resource for getting the data. Internally, that resource will create a JobID and query against the JobID and return results directly.Again, this is a feature request if it helps others as well.

Thanks again for your help.

Running the query may take a long time so we provide an asynchronous access model - so even if we had a way to get data of a path, it would follow the same model.

Hey I wrote a small nodejs wrapper around dremio rest api, it quite primitive and simple. but does exactly that, handles authentication, takes a SQL, poll the job status and return the result.

if you think it could be useful i could put it on npm

1 Like

Hi,

sorry for the delayed answer, got caught up in daily work. It will be really helpful if you could put on the npm to use it.

Thanks.

Kind Regards,
Ajay