Skip to content

Conversation

@thrau
Copy link
Member

@thrau thrau commented Dec 17, 2025

Motivation

I've wanted better API clients for a while, where classes map to the actual APIs and their API concepts. These can then be used to implement higher-level abstractions like the DataSource class.

With #4 , it's now massively easier to develop and test this, so I went on a quest to implement the most important APIs.

The following APIs have been (partially) implemented, and can be accessed through Client.api:

  • /v0/datasources: client.api.datasources
  • /v0/events: client.api.events
  • /v0/pipes: client.api.pipes
  • /v0/tokens: client.api.tokens
  • /v0/variables: client.api.variables

Examples

For example, you can query a pipe using the pipes API:

from verdin import tinybird

client = tinybird.Client(...)

response = client.api.pipes.query(
    "my_pipe",
    parameters={"my_param": "..."},
    query="SELECT * FROM _ LIMIT 10",
)

for record in response.data:
    # each record is a dictionary
    ...

Or use the HFI endpoint to append data:

from verdin import tinybird

client = tinybird.Client(...)

response = client.api.events.send("my_datasource", records=[
    {"id": "...", "value": "..."},
    ...
])
assert response.quarantined_rows == 0

Changes

@thrau thrau marked this pull request as ready for review December 18, 2025 09:15
@thrau thrau merged commit ed4f1c8 into main Dec 18, 2025
5 checks passed
@thrau thrau mentioned this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants