> ## Documentation Index
> Fetch the complete documentation index at: https://dune-tables-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Client SDKs

## Python

We currently support a [Python SDK](https://github.com/duneanalytics/dune-client) for working with our API. You'll find `Python SDK` snippets on all endpoint pages, if you want to go deeper into the code then check out [these files](https://github.com/duneanalytics/dune-client/tree/main/dune_client/api).

To still the SDK, run the following command in your terminal:

```bash
pip install dune-client
```

<Warning>
  Be sure you are using the latest release. You can find all release versions [here](https://github.com/duneanalytics/dune-client/releases) - there may be code added to the repo that has not been put into a release yet.
</Warning>

You will commonly work with the `QueryBase` class which can be created like this:

```python
from dune_client.types import QueryParameter
from dune_client.client import DuneClient
from dune_client.query import QueryBase

query = QueryBase(
    name="Sample Query",
    query_id=1215383,
    params=[
        QueryParameter.text_type(name="TextField", value="Word"),
        QueryParameter.number_type(name="NumberField", value=3.1415926535),
        QueryParameter.date_type(name="DateField", value="2022-05-04 00:00:00"),
        QueryParameter.enum_type(name="EnumField", value="Option 1"),
    ],
)
print("Results available at", query.url())
```

The query object is defined as `QueryBase` and all properties can be found [in this file](https://github.com/duneanalytics/dune-client/blob/main/dune_client/query.py).

Other classes such as execution results can be [found here](https://github.com/duneanalytics/dune-client/blob/main/dune_client/models.py#L244C7-L244C22), detailing operations like `ResultsResponse.get_rows()` for getting the data out of a GET request.

If you are trying to load data into a Pandas DataFrame, you can use the following function from the sdk.

```python
results_df = dune.run_query_dataframe(query)
```

## Typescript

We have a community client from the Cow Protocol team that can be [found here](https://www.npmjs.com/package/@duneanalytics/client-sdk).

To install, run this command

```bash
yarn add @duneanalytics/client-sdk
```

Currently this client only supports the execution based endpoints, and not Query Endpoints or uploads. Here is an example query:

```typescript
import { QueryParameter, DuneClient } from "@duneanalytics/client-sdk";
const { DUNE_API_KEY } = process.env;

const client = new DuneClient(DUNE_API_KEY ?? "");
const queryID = 1215383;
const params = {
  query_parameters = [
    QueryParameter.text("TextField", "Plain Text"),
    QueryParameter.number("NumberField", 3.1415926535),
    QueryParameter.date("DateField", "2022-05-04 00:00:00"),
    QueryParameter.enum("ListField", "Option 1"),
  ]
};

client
  .runQuery(queryID, params)
  .then((executionResult) => console.log(executionResult.result?.rows));
```
