Skip to content

Edit MySQL Query

This page explains updating a saved MySQL query in the Pirivision Compass module via the Edit action.

Prerequisite

At least one MySQL query must be saved in the Compass list. If none, see Create MySQL Query first.


1. Find the Query and Click Edit

Click Compass in the left menu. On the card of the MySQL query you want to edit, click the Edit button.


2. The SQL Editor Opens — Existing Query Pre-filled

The editor pre-loads the existing MySQL query.


3. Editable Fields

Field Editable? Notes
SQL Query Text ✅ Yes Including MySQL functions (DATE_SUB, IFNULL, backticks)
Query Name ✅ Yes In the save panel
Description ✅ Yes In the save panel
Global Variables ✅ Yes Add / edit / delete
Target Folder ✅ Yes A different folder can be picked
Data Source ❌ No Create a new query for a different MySQL

4. Update and Test

Make the changes in the editor. Test with the Run button.

MySQL Update Tips

  • Increase LIMIT N to fetch more rows.
  • To widen the DATE_SUB() range, change the INTERVAL X DAY value.
  • Add IFNULL(value, 0) to prevent null values from appearing as blanks in the table.

5. Save

Click the Save button. Update the fields in the save panel. Save with Save.


6. Common Errors

Error / Symptom Possible Cause Solution
"you already have a query named '...'" The new name is used by another query Enter a different name
Error 1064: SQL syntax error Missing backtick or syntax error Review MySQL syntax
Error 1054: Unknown column '...' Column name has changed Verify it in the table browser
"update failed: no rows were affected" The update was not saved Refresh the page and try again
Cartography widget appears empty A column name changed Update the widget's data mapping

MySQL Queries — Overview