---
title: "Expressions Tutorial: Setup"
description: "Verify the database is running, install the client, and initialize the connection for the Aerospike expressions tutorial."
---

# Setup

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

## Verify database is running

This tutorial requires that Aerospike database is running. Before starting the examples below, verify this from a terminal with [`asinfo`](https://aerospike.com/docs/database/tools/asinfo) (part of the [Aerospike Tools](https://aerospike.com/docs/database/tools/) package), for example `asinfo -v status`.

## Download and install additional components

Install the Aerospike client for your preferred language in a version with support for expressions.

-   [Java](#tab-panel-5673)
-   [Python](#tab-panel-5674)
-   [Go](#tab-panel-5675)
-   [C#](#tab-panel-5676)
-   [Node.js](#tab-panel-5677)
-   [Rust](#tab-panel-5678)

Add the Aerospike Java client to your project’s Maven `pom.xml`:

```xml
<dependencies>

  <dependency>

    <groupId>com.aerospike</groupId>

    <artifactId>aerospike-client</artifactId>

    <version>10.4</version>

  </dependency>

</dependencies>
```

Install the Aerospike Python client and its `aerospike_helpers` package, which provides the expressions used throughout this tutorial.

Terminal window

```sh
pip install aerospike
```

Install the Aerospike Go client, which provides the expression builder functions used throughout this tutorial.

Terminal window

```sh
go get github.com/aerospike/aerospike-client-go/v6
```

Install the Aerospike C# client NuGet package, which provides the expression builder classes used throughout this tutorial.

Terminal window

```sh
dotnet add package Aerospike.Client
```

Install the Aerospike Node.js client, which provides the `exp` module used throughout this tutorial.

Terminal window

```sh
npm install aerospike
```

Install the Aerospike Rust client, which provides the expression builder functions used throughout this tutorial. The client requires an async runtime; this tutorial uses Tokio.

Terminal window

```sh
cargo add tokio --features macros,rt-multi-thread

cargo add aerospike --features rt-tokio
```

## Initialize client

::: destructive cleanup
The `truncateTestData()` helper deletes all records in the tutorial namespace and set. Use a disposable test cluster or confirm the target namespace and set before running it.
:::

Initialize the client. Also, define constants including the namespace `test` and set `expressions` and a convenient function `truncateTestData`.

-   [Java](#tab-panel-5679)
-   [Python](#tab-panel-5680)
-   [Go](#tab-panel-5681)
-   [C#](#tab-panel-5682)
-   [Node.js](#tab-panel-5683)
-   [Rust](#tab-panel-5684)

```java
import com.aerospike.client.AerospikeClient;

AerospikeClient client = new AerospikeClient("localhost", 3000);

System.out.println("Initialized the client and connected to the cluster.");

final String NAMESPACE = "test";

final String SET_NAME = "expressions";

// convenience functions to truncate test data

void truncateTestData() {

    try {

        client.truncate(null, NAMESPACE, SET_NAME, null);

    }

    catch (AerospikeException e) {

        // ignore

    }

}
```

> Output:
> 
> Initialized the client and connected to the cluster.

```python
import aerospike

config = {'hosts': [('127.0.0.1', 3000)]}

client = aerospike.client(config).connect()

print("Initialized the client and connected to the cluster.")

NAMESPACE = "test"

SET_NAME = "expressions"

# convenience function to truncate test data

def truncate_test_data():

    try:

        client.truncate(NAMESPACE, SET_NAME, 0)

    except aerospike.exception.AerospikeError:

        pass  # ignore
```

> Output:
> 
> Initialized the client and connected to the cluster.

The Go examples in this tutorial build on the following setup, assumed to persist for the rest of this page’s `client`, `NAMESPACE`, `SET_NAME`, and `truncateTestData` across later code blocks (each block also lists any additional imports it needs).

```go
import (

    "fmt"

    "log"

    as "github.com/aerospike/aerospike-client-go/v6"

)

client, err := as.NewClient("localhost", 3000)

if err != nil {

    log.Fatal(err)

}

fmt.Println("Initialized the client and connected to the cluster.")

const NAMESPACE = "test"

const SET_NAME = "expressions"

// convenience function to truncate test data

func truncateTestData() {

    if err := client.Truncate(nil, NAMESPACE, SET_NAME, nil); err != nil {

        // ignore

    }

}
```

> Output:
> 
> Initialized the client and connected to the cluster.

The C# examples in this tutorial build on the following setup, assumed to persist for the rest of this page’s `client`, `NAMESPACE`, `SET_NAME`, and `TruncateTestData` across later code blocks.

```csharp
using Aerospike.Client;

Host host = new Host("localhost", 3000);

AerospikeClient client = new AerospikeClient(null, host);

Console.WriteLine("Initialized the client and connected to the cluster.");

const string NAMESPACE = "test";

const string SET_NAME = "expressions";

// convenience function to truncate test data

void TruncateTestData()

{

    client.Truncate(null, NAMESPACE, SET_NAME, null);

}
```

> Output:
> 
> Initialized the client and connected to the cluster.

The Node.js examples in this tutorial build on the following setup, assumed to persist for the rest of this page’s `client`, `NAMESPACE`, `SET_NAME`, and `truncateTestData` across later code blocks.

```js
const Aerospike = require('aerospike');

const exp = Aerospike.exp;

const op = Aerospike.operations;

const config = { hosts: '127.0.0.1:3000' };

const client = await Aerospike.connect(config);

console.log('Initialized the client and connected to the cluster.');

const NAMESPACE = 'test';

const SET_NAME = 'expressions';

// convenience function to truncate test data

async function truncateTestData() {

    await client.truncate(NAMESPACE, SET_NAME, 0);

}
```

> Output:
> 
> Initialized the client and connected to the cluster.

The Rust examples in this tutorial build on the following setup, assumed to persist for the rest of this page’s `client`, `NAMESPACE`, `SET`, and `truncate_test_data` across later code blocks. Each block runs inside an async function, for example `#[tokio::main] async fn main() -> aerospike::Result<()> { ... }`, so `.await` and `?` are available.

```rust
use aerospike::{AdminPolicy, Client, ClientPolicy};

let client = Client::new(&ClientPolicy::default(), &"127.0.0.1:3000".to_string()).await?;

println!("Initialized the client and connected to the cluster.");

const NAMESPACE: &str = "test";

const SET: &str = "expressions";

// convenience function to truncate test data

async fn truncate_test_data(client: &Client) {

    let _ = client.truncate(&AdminPolicy::default(), NAMESPACE, SET, 0).await;

}
```

> Output:
> 
> Initialized the client and connected to the cluster.

## Access shell commands

You may execute shell commands including Aerospike tools such as [aql](https://aerospike.com/docs/database/tools/aql) and [asadm](https://aerospike.com/docs/database/tools/asadm) from a terminal throughout this tutorial.

## Next

Continue to [Understanding expressions](https://aerospike.com/docs/develop/tutorials/operations/expressions/concepts).