Connections Pane

The Connections Pane allows you to manage and explore database connections for use within your Python and/or R sessions. You can create connections to databases, explore their schemas, and interactively preview database tables.

Connections Pane

Explore your database schema

Once you create a new connection, you can use the Connections Pane to explore the database schema.

Connections Pane showing database schema, tables, and columns

You can navigate through the database schema, viewing tables, columns, and their data types. You can also click the table icon to explore a preview of the database contents in the Data Explorer.

Create a new connection

You can create a new connection to a database either from the UI, or using Python or R code.

Create a new connection from the UI

To open a new connection, click on the “New connection” button in the Connections Pane. This will open a modal that allows you to select the connection type and fill in the connection details. This modal generates the code required to open the connection in your R or Python session.

New connections modal

When you create a new connection, Positron stores and manages connection strings for future usage.

Create a connection using R

To create a connection in the 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:

con <- connections::connection_open(RSQLite::SQLite(), "nycflights13.sqlite")

Click on the connection object from the Variables Pane or use connections::connect_view(con) to open the Connections Pane.

You can find more information about connecting to a specific database from Posit Solutions Engineering.

Create 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
conn = sqlite3.connect("nycflights13.sqlite")

You can then either use %connection_show conn to open the connection in the Connections Pane or open it from the Variables Pane.

Explore a connection from the Variables Pane

You can open an existing connection that you created from Python or R from the Variables Pane:

Variables Pane showing a connection object

Click the database icon to bring up the Connections Pane, allowing you to navigate the database.