Get Started with PromptQL and PostgreSQL
Overview
This tutorial takes about twenty minutes to complete. You'll learn how to:
- Set up a new PromptQL project
- Connect it to PostgreSQL
- Generate your agentic semantic metadata layer
- Create a build
- Talk to PromptQL
Additionally, we'll familiarize you with the steps and workflows necessary to iterate on your metadata.
This tutorial assumes you're starting from scratch; you can use an existing PostgreSQL database that you have or the PostgreSQL docker image that ships with the data connector.
Prerequisites
Install the DDN CLI
To use this guide, ensure you've installed/updated your CLI to at least v2.28.0
.
- macOS and Linux
- Windows
Simply run the installer script in your terminal:
curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v4/get.sh | bash
Currently, the CLI does not support installation on ARM-based Linux systems.
- Download the latest DDN CLI installer for Windows.
- Run the
DDN_CLI_Setup.exe
installer file and follow the instructions. This will only take a minute. - By default, the DDN CLI is installed under
C:\Users\{Username}\AppData\Local\Programs\DDN_CLI
- The DDN CLI is added to your
%PATH%
environment variable so that you can use theddn
command from your terminal.
Install Docker
The Docker-based workflow helps you iterate and develop locally without deploying any changes to Hasura DDN, making the
development experience faster and your feedback loops shorter. You'll need Docker Compose v2.20
or later.
Validate the installation
You can verify that the DDN CLI is installed correctly by running:
ddn doctor
Tutorial
Step 1. Authenticate your CLI
ddn auth login
This will launch a browser window prompting you to log in or sign up for Hasura DDN, our cloud provider. After you log in, the CLI will acknowledge your login, giving you access to Hasura DDN resources.
Step 2. Scaffold out a new local project
ddn supergraph init my-project --with-promptql && cd my-project
Once you move into this directory, you'll see your project scaffolded out for you. You can view the structure by either
running ls
in your terminal, or by opening the directory in your preferred editor.
Step 3. Initialize your connector
ddn connector init my_connector -i
Select hasura/postgres-promptql
(you can type to filter the list). Then, enter the following environment variables:
ENV | Example | Description |
---|---|---|
JDBC_URL | jdbc:postgresql://<host>:<port>/<database>?user=<username>&password=<password> | The JDBC URL to connect to the PostgreSQL database. |
JDBC_SCHEMAS | public,app | The schemas to use for the database. Optional. This can also be included in the connection string. |
When entering schemas, ensure there's no whitespace as in the example above.
Hasura will never modify your source schema.