Local Database Connection

When running Lapis locally, you can access its database by it using the information from your Lapis .env file.

In this example we are using DBeaver to connect to the database.

Connecting to the database using DBeaver

Before trying to connect to your database, ensure your local Lapis is running (docker compose up local)

  1. Select New Database Connection which is located in the top left corner below File

    New Database Connection

  2. Select PostgreSQL, then click Next

  3. Fill out the Connection Settings using the related keys from your Lapis .env file

    1. Host: localhost
    2. Port: DB_PORT
    3. Database: DB_DATABASE
    4. Username: DB_USERNAME
    5. Password: DB_PASSWORD

    Example Connection

  4. Click Test Connection..., and if it succeeds click Finish

Connecting to the database using VSCode

As above, ensure your lapis container is running before trying to connect to the database.

  1. Install the VSCode PostgreSQL Extension if you do not already have it installed

  2. Click the postgresql explorer icon in the sidebar

  3. Click the + (add connection) button

  4. Configure the connection:

    1. Enter localhost as the address
    2. Enter the DB_USERNAME from .env
    3. Enter the DB_PASSWORD from .env
    4. Leave the port set to 5432
    5. Choose Standard Connection
    6. Select All Databases
    7. Give your connection a name (for example, local lapis)

You’re done! Now you can browse the database connection directly from VSCode. Just click the elephant icon, then expand the connection you made earlier.

To run queries on tables, you can either open the command palette and type New Query or right click on a table and run a custom query or one of the prebaked queries.