Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API REST source type #396

Closed
csansoon opened this issue May 9, 2024 · 3 comments
Closed

API REST source type #396

csansoon opened this issue May 9, 2024 · 3 comments
Labels
enhancement New feature or request stale

Comments

@csansoon
Copy link
Contributor

csansoon commented May 9, 2024

Feature Description

A new source type that allows to use Latitude on API REST endpoints.

Proposal

Usage

An API source type can be configured with the the following schema:

type: api
config:
  method: GET
  headers:
    Authorization: <custom auth header>
    (... other custom headers)

Then, the sql query can be used as follows:

{@config method = 'POST'} -- Optional configuration overrides
SELECT *
FROM {api('https://api.example.com/v1/data')}
WHERE id = 1

Implementation

This api function is a exclusive method for this source type. In compile time, it will make a request based on the function parameters and source configuration, save the response as a temporary parquet file, and include it in the query. Then, the query will be executed as usual by a DuckDB connector.

To be able to parse the response, currently it must follow a given JSON schema previously defined by us.

Alternatively, we can require the user to define each endpoint in the source config file, or maybe in a {@config} tag within the query, following the OpenAPI specification. This would allow the user to define the endpoints and their parameters in a standard way, and then use it in the query by refering to the endpoint id and passing parameters as a second argument.

@geclos
Copy link
Contributor

geclos commented May 9, 2024

fantastic 👌🏼

@andresgutgon andresgutgon added the enhancement New feature or request label Jun 3, 2024
Copy link
Contributor

github-actions bot commented Jul 4, 2024

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jul 4, 2024
Copy link
Contributor

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

3 participants