Tinybird is a modern realtime data platform designed specifically for data engineers. It empowers data teams to effortlessly ingest streaming & batch data, develop data products using standard SQL, and publish the results as high-concurrency, low-latency HTTP APIs.
In this guide, we'll transform Tinybird's OpenAPI schema into GraphQL using the Grafbase Edge Gateway and @openapi
connector.
You'll want to make sure you have some Data Sources and Pipes configured before you continue with the rest of this guide.
Here's the data flow of the example workspace I created when joining Tinybird.
In Tinybird, open your API Endpoint page for a Pipe then click View API:
Next click Share docs:
Now click OpenAPI 3.0 and copy the URL:
Inside of a new or existing project directory, run the following:
npx grafbase init --template openapi-tinybird
Now open grafbase/.env
and provide the environment variables you obtained in the steps above:
# TINYBIRD_API_URL is the URL for your published API Endpoint
TINYBIRD_API_URL=
# TINYBIRD_API_TOKEN is the Auth Token with READ access to the API Endpoint
TINYBIRD_API_TOKEN=
# TINYBIRD_API_SCHEMA is the OpenAPI 3.0 spec URL copied from the API Endpoint docs page
TINYBIRD_API_SCHEMA=
Now you're ready to use the Grafbase CLI to start the development server:
npx grafbase dev
That's it! You're now ready to execute Tinybird queries with GraphQL.
Open Pathfinder and you should now see the generated GraphQL queries that are named after your Tinybird Pipes:
Let's finish by executing the following GraphQL query:
{
tinybird {
topPages {
data {
hits
visits
}
rows
}
}
}
Make sure to replace topPages
with the name of your Tinybird pipe.