Help / Databases

How do I build a quiz from a Postgres, MySQL or Snowflake database?

Rank a whole Postgres, MySQL, MariaDB or Snowflake table, even millions of rows, with a quiz.

Create quiz → Create from a database connects a Postgres database (also Supabase, Neon, Amazon RDS, Azure and Google Cloud SQL) or a MySQL 8.0.17+ or MariaDB 10.6+ database (also PlanetScale, Amazon RDS and the database a WordPress site runs on). Selfscovery only reads, through a read-only session; use a login that can only SELECT. The login stays in this device’s secure storage.

Snowflake: enter the account identifier (Snowsight → your name → Account → View account details), database, warehouse and user. Sign in with a programmatic access token (Snowsight → your name → Settings → Authentication) and Selfscovery adds a key for this device to your user by itself, so the token isn’t kept. Or choose No token? Use a key from this device and run the one line it shows in a Snowsight worksheet. Snowflake has no read-only session, so use a role that can only read.

Choose the items table, which column is each row’s key and which is its name, and where the attributes are:

  • An attribute table: one row per item per attribute, with an optional score. Fastest at any size.
  • Columns on the items table: a keyword list (an array, a JSON array or text with a separator, with an optional list of scores in the same order), a JSON object of scores, a column whose value is the attribute (Equals), a number column, or a true/false column.

Choose the attributes answers should weigh, try a ranking of the whole table, then build the quiz with AI or by hand.

The quiz keeps a snapshot: the best rows for each attribute and the rows matching the most of them, as ordinary results. Published and shared quizzes use it and never connect to the database.

When the table changes, or after adding attributes to answers, use Refresh from database on the quiz (part of Selfscovery Pro). Selfscovery also checks the snapshot against live rankings for sample answers and tells you how closely it matches.

Database settings on the quiz card adds or removes attributes, sets the quiz’s own filters (Only rows with, such as active; Never rows with, such as placed), and leaves out specific rows. The table itself never changes.

One device can keep several databases: switch or add one from the connection menu, which also has Test connection. If a quiz spells an attribute differently from the table (Marine for marine), refresh corrects it to the table’s spelling. MySQL and MariaDB match either spelling.

Live results: turn this on in Database settings to rank every row each time someone finishes, so new and changed rows count straight away. It works in a Device quiz on a device connected to the database, and on your WordPress site: publish the quiz from the device with the database connection, then add a read-only login for the database in WordPress under Selfscovery → Live rankings. For Snowflake, the site makes its own key and shows the SQL to run once in Snowsight. The site ranks the table itself; visitors only send their answers and see the top results. Shared HTML files, and anywhere the database can’t be reached, use the saved results.

Still stuck? Email [email protected]. All help topics