Connections Pane
The Connections Pane allows you to explore database connections created within your R or Python sessions. It also includes basic support for storing and managing connection strings for future usage.
Opening a connection using R
To open a connection in Positron Connections Pane, you need to connect to a database using any package that supports the connections contract, such as odbc, sparklyr, bigrquery, and others.
The Positron Connections Pane implements RStudio’s connections contract; this means that any package that works within RStudio’s Connections Pane should work within the Positron Connections Pane.
Here is an example of how to open a connection using the connections package to open a SQLite connection:
<- tempfile()
tmp dir.create(tmp)
::nycflights13_sqlite(path = tmp)
dbplyr<- connections::connection_open(RSQLite::SQLite(), file.path(tmp, "nycflights13.sqlite")) con
You can also open an existing connection from the Variables Pane, as shown below for Python, and you can find more information about connecting to a specific database from Posit Solutions Engineering.
Opening a connection using Python
Currently we support connections created using the sqlite3 and SQLAlchemy modules. To open a connection in the Connections Pane, create a top level object that represents the connection/engine.
import sqlite3
= sqlite3.connect("nycflights13.sqlite") conn
You can then either use %connection_show conn
to open the connection in the Connections Pane or click on the database icon that appears close to the object name in the Variables Pane.
That will bring up the Connections Pane, allowing you to navigate the database.