# HP Vertica

You can quickly import data from your HP Vertica Database into Exploratory.

## 1. Create a Connection to use

Create a connection following [this instruction](https://docs.exploratory.io/data_import/database-data/connection).

## 2. Open HP Vertica Import dialog

Click '+' button next to 'Data Frames' and select 'Import Database Data'.

![](https://2850417076-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4HLCK3olgduYoe3RVS%2Fsync%2Fa2e921dc2eda9fe2edf8249b02f331f913c73830.png?generation=1611361419527553\&alt=media)

Click HP Vertica to select.

![](https://2850417076-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4HLCK3olgduYoe3RVS%2F-M4oMvCUDQwHTJ0eWi_f%2F-M4oNA4QlzUrtCkpxq2N%2Fhp-vertica-dialog.png?generation=1586795470178426\&alt=media)

## 3. Import

1. Put data frame name.
2. Select connection from left dialog box.
3. Write a query in the input field.
4. Click "Preview" button. Then you will see the preview of the data.
5. Click "Import" button.

![](https://2850417076-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4HLCK3olgduYoe3RVS%2F-M4oMvCUDQwHTJ0eWi_f%2F-M4oNA4TVgsrEkWpL_x8%2Fimport-hp-vertica-dialog.png?generation=1586795470072633\&alt=media)

If it looks ok, then you can click 'Import' to import the data into Exploratory.

## 4. Using Variables in SQL

First, create a custom R script.

![](https://2850417076-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4HLCK3olgduYoe3RVS%2F-M4oMvCUDQwHTJ0eWi_f%2F-M4oNA4VSoPDigL48Qrt%2Fadd_script.png?generation=1586795469793533\&alt=media)

Second, define a variable in the R script and save.

![](https://2850417076-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4HLCK3olgduYoe3RVS%2F-M4oMvCUDQwHTJ0eWi_f%2F-M4oNA4X41Hk5MMomwsC%2Fset_variables.png?generation=1586795470051770\&alt=media)

```
cutoff_date <- "\'2016-01-15\'"
```

Note that the ‘\’ (backslash) symbols are used to escape the single quotes, which are required to be used for characters in SQL queries.

Finally, you can use @{} to surround a variable name inside the query like below.

```
select *
from airline_2016_01
where fl_date > @{cutoff_date}
```

Here's a [blog post](https://blog.exploratory.io/using-variables-in-sql-query-2740924d9f20#.bdcn5v68x) for more detail.
