Requirements and setup

In this tutorial, we will connect to Starburst Galaxy and verify our connection. Following tutorials will go through the basics of Ibis on Starburst Galaxy’s demo data.


You need a Python environment with Ibis installed and a Starburst Galaxy account.

Connect to Starburst Galaxy

First, connect to Starburst Galaxy. We’ll use a .env in this example for secrets that are loaded as environment variables. This requires installing the python-dotenv package – alternatively, you can set the environment variables for your system.


Hover over (or click on mobile) the numbers in the code blocks to see tips and explanations.

import os
import ibis
from dotenv import load_dotenv

ibis.options.interactive = True


user = os.getenv("USERNAME")
password = os.getenv("PASSWORD")
host = os.getenv("HOSTNAME")
port = os.getenv("PORTNUMBER")
catalog = "sample"
schema = "demo"

con = ibis.trino.connect(
    user=user, password=password, host=host, port=port, database=catalog, schema=schema
Import necessary libraries.
Use Ibis in interactive mode.
Load environment variables.
Load secrets from environment variables.
Use the sample demo data.
Connect to Starburst Galaxy.
Display the connection object.
<ibis.backends.trino.Backend at 0x13f48e850>

Verify connection

List the tables your connection has:

['astronauts', 'missions']

Run a SQL query:

con.sql("select 1 as a")
┃ a     ┃
│ int32 │
│     1 │

If you have any issues, check your connection details above. If you are still having issues, open an issue on Ibis and we’ll do our best to help you!

Next steps

Now that you’re connected to Starburst Galaxy, you can continue this tutorial to learn the basics of Ibis or query your own data. See the rest of the Ibis documentation or Starburst Galaxy documentation. You can open an issue if you run into one!

Back to top