Create a sample database for your trial

QueryDesk needs a connected database before it can do anything. If you don't want to connect a real database for your trial, or can't make one reachable from QueryDesk Cloud, this guide gives you one: download a script, run it on a free PostgreSQL host, and connect the result. It takes about 10 minutes.

The database belongs to Pinnacle Trust Financial Group (PTFG), a fictional bank. It holds the kind of data a bank guards closely: Social Security numbers, card numbers, account and routing numbers, balances, and fraud alerts. Every name, account, and number in it is fabricated. The Getting Started Guide uses it for its examples.


Before you begin

You will need:

  • A PostgreSQL host. This guide uses Neon, which offers a free plan at the time of writing. Neon is not required. Any PostgreSQL 13 or later database that accepts connections from 35.224.237.12 works. See Use a different PostgreSQL host.
  • A password manager, or another safe place to store two generated passwords.

Download the script

Download querydesk-sample-ptfg.sql

The script:

  • Creates 10 tables, 4 views, and the PTFG sample data.
  • Creates two database users, each with a randomly generated 64-character password:
    • querydesk_readonly can read data.
    • querydesk_readwrite can read, insert, update, and delete data.
  • Returns the database name, both usernames, and both passwords as its final result.

Neither user can create, change, or drop tables. The passwords are generated when the script runs and never appear in the script itself.

The script deletes nothing. Run it only on a new, empty database. If PTFG's tables or users already exist, it stops with an error.


Create a Neon project

  1. Sign up at neon.com and create a project.
  2. Set these options for the project:
    • Postgres version: the latest.
    • Region: AWS US East 2 (Ohio). It's the closest region to QueryDesk Cloud.
    • Database name: anything. The default is fine. The script reads the name and returns it with the passwords.

Run the script

  1. In your Neon project, open SQL Editor. Confirm the database selector shows your new project's database.
  2. Open querydesk-sample-ptfg.sql in a text editor such as Notepad or TextEdit. Copy the entire contents and paste them into the SQL Editor.
  3. Click Run.
  4. Neon shows one result tab for each statement in the script, about 50 in all. Click the last tab. It shows two rows:
database_nameusernamepassword
Your database namequerydesk_readonlyA 64-character password
Your database namequerydesk_readwriteA 64-character password
  1. Copy the database name, both usernames, and both passwords into your password manager.

Connect PTFG to QueryDesk

Copy the host from Neon

  1. On your Neon project's dashboard, click Connect.
  2. Turn Connection pooling off. QueryDesk connects to the database directly.
  3. Copy the host from the connection string: everything between @ and the next /. It starts with ep- and ends with neon.tech, for example ep-cool-darkness-123456.us-east-2.aws.neon.tech.

Complete the Connect a database form

The first time you sign in, QueryDesk opens the Connect a database form.

  1. Select PostgreSQL as the Engine.
  2. Complete the connection fields:
FieldValue
Display nameAny name that's useful to you, for example PTFG Sample.
HostThe host you copied from Neon.
Database nameThe database name from the script's result.
Port5432. This is filled in for you.
Usernamequerydesk_readonly
PasswordThe password for querydesk_readonly.
  1. Expand Advanced and turn on Connect over SSL. Neon accepts only encrypted connections. Leave the certificate fields empty and Verify server hostname (verify-full) off.
  2. Click Test connection. When Connection successful appears, click Finish setup.

Keep querydesk_readwrite and its password. You'll add them as a second credential in the Getting Started Guide's Create an approval flow section.

Continue with First look at QueryDesk.


What's in PTFG

All tables and views are in the public schema.

TableContents
branches10 branches across five regions
employees12 employees, with SSNs, dates of birth, and salaries
customers15 customers, with SSNs, dates of birth, and contact details
accounts19 checking, savings, money market, and CD accounts
payment_cards13 debit, credit, and prepaid cards, with card numbers and CVVs
bank_account_details15 routing and account number pairs
transactions23 transactions, one flagged as suspicious
loans10 personal, auto, home, and student loans
fraud_alerts8 alerts, 2 unresolved
audit_log10 records of PTFG employees accessing sensitive fields
ViewContents
vw_customer_piiEach customer's SSN, date of birth, contact details, and branch
vw_account_summaryEach account's number, type, status, balance, customer, and branch
vw_card_piiEach card's number, CVV, and expiry, with the cardholder's email and SSN
vw_open_fraud_alertsUnresolved fraud alerts with customer and account details

The tables and views that hold SSNs, card numbers, and account numbers are good targets when you try data protection.


Use a different PostgreSQL host

Any PostgreSQL host works if all of the following are true:

  • It runs PostgreSQL 13 or later.
  • It accepts connections from 35.224.237.12.
  • The database is new and empty.
  • You run the script as a user that can create other users, such as the database owner or an admin user.

Run the script in your host's SQL tool, or with psql:

psql "postgresql://<admin_user>@<host>:5432/<database_name>" -f querydesk-sample-ptfg.sql

psql prompts for the admin user's password and prints the credentials result last. Connect to QueryDesk as described in Connect PTFG to QueryDesk, using your host's values. Turn on Connect over SSL only if your host requires encrypted connections.


Troubleshooting

The script stops with type "account_type_enum" already exists. The script has already run on this database. Create a new Neon project and run it there.

The script stops with role "querydesk_readonly" already exists. Database users belong to the whole PostgreSQL server, not to a single database, and this server already has them. This happens when the script runs on a second database in the same Neon project. Create a new Neon project and run it there.

Test connection fails with an SSL or handshake error. Connect over SSL is off. Expand Advanced and turn it on.

The first connection or query after a break takes several seconds. Neon pauses idle compute after 5 minutes and starts it again on the next connection. Later queries run at normal speed.

Was this page helpful?