# redivis$connect\_dbi

### **redivis$**<mark style="color:purple;">**connect\_dbi**</mark>**()** → [DBI::DBIConnection](https://dbi.r-dbi.org/reference/DBIConnection-class.html)

Returns a DBI connection that can be used by dbplyr and other interfaces tha work with DBI. This connection will be globally scoped, and all table names must be appropriately qualified.

To create a connection scoped to particulary dataset or workflow, see:

* [Dataset$connect\_dbi()](https://docs.redivis.com/api/client-libraries/redivis-r/reference/dataset/datasetusdconnect_dbi)
* [Workflow$connect\_dbi()](https://docs.redivis.com/api/client-libraries/redivis-r/reference/workflow/workflowusdconnect_dbi)

{% hint style="info" %}
For advanced use cases, you can also access the Redivis DBI interface at `redivis::RedivisDBI`. `redivis$connect_dbi()` is the same as calling: `DBI::dbConnect(redivis::RedivisDBI())`
{% endhint %}

### **Returns:**

[**DBI::DBIConnection**](https://dbi.r-dbi.org/reference/DBIConnection-class.html)

### Examples

```r
con <- redivis$connect_dbi()

tbl(con, "demo.ghcn_daily_weather_data.stations") |> filter(latitude > 0) |> collect()

# Prints a tibble with the relevant weather stations
```
