PostgreSQL

Connecting Your Postgres Database to Sequel

Welcome to Sequel! This guide will help you connect your PostgreSQL database to Sequel, enabling you to run SQL queries using natural language and visualize results with charts and graphs.

Prerequisites

Before you begin, ensure you have the following:

  • PostgreSQL Database: Make sure your PostgreSQL database is set up and running.
  • Database Credentials: You will need the following details:
    • Hostname or IP address
    • Database name
    • Username
    • Password
    • Port (default: 5432)
  • Sequel Account: You must have a Sequel account. If you haven’t signed up yet, you can create an account at Sequel.

Step 1: Navigate to Database Connections

  1. On the Sequel dashboard, locate the menu on the left-hand side.
  2. Click on Database Connections to open the database management page.

Step 2: Add a New Connection

  1. In the Databases section, click the New Connection button.
  2. From the list of available database types, select PostgreSQL.

Step 3: Enter Connection Details

You will now need to enter the required information to connect your PostgreSQL database:

  1. Display Name: Give your connection a meaningful name (e.g., "Production Database" or "Analytics DB").
  2. Host: Enter the hostname or IP address of your PostgreSQL database server.
  3. Port: The default port for PostgreSQL is 5432. If your database uses a different port, specify that here.
  4. Database Name: Enter the name of the PostgreSQL database you want to connect to.
  5. Username: Provide the PostgreSQL username with access to the database.
  6. Password: Enter the password for the PostgreSQL user.

Optionally, you may also configure SSL settings or provide additional connection parameters if required by your PostgreSQL setup.

Step 4: Test andSave the Connection

Click on test and save connection button to test the connection details and save the connection. After a successful test Sequel will open the explorer view for your connected database. You can now ask your database questions or execute SQL queries.

Step 5: Query Your Database

Now that your PostgreSQL database is connected, you can start querying it using natural language:

  1. Return to the Sequel dashboard.
  2. In the query input box, type a question or request, such as “Show me the list of users added last month” or “What is the average order value?”.
  3. Sequel will convert your request into an SQL query, execute it against your PostgreSQL database, and display the results.

Step 6: Visualize Data with Charts and Graphs

Sequel also allows you to create visualizations simply by asking it to visualize the data as a bar chart, line chart or a pie chart.

eg:

  1. Show me the user growth in last 30 days in a line chart
  2. Show me a bar graph of my top selling products
  3. Show me a pie chart of top 10 organisations with most number of users

Troubleshooting

If you encounter any issues during the connection process:

  1. Connection Errors: Double-check your credentials and ensure your PostgreSQL database is reachable from the internet (or from within your local network if using a private instance).
  2. Firewall/Network Issues: Ensure that your PostgreSQL database server allows connections from Sequel's IP addresses or the IP address of your local machine (if using Sequel on-prem).
  3. SSL Configuration: If your PostgreSQL server requires SSL, make sure the proper SSL certificates and settings are provided during connection setup.

Conclusion

That’s it! You’ve successfully connected your PostgreSQL database to Sequel. Now you can leverage Sequel’s powerful natural language processing to query your database and generate insightful visualizations.

If you have any further questions or need additional help, feel free to reach out to our support team or consult the Sequel documentation.

Happy querying!


Additional Resources