Concepts

Safeguards for production databases

A wrong SQL statement run once on a production database is hard to undo. NeoSQL puts several layers of safeguards against mistakes. Each safeguard is set by a different person and covers different executions, so make sure that the place you trust to protect you is not actually uncovered.

Safeguards come in layers

SafeguardSet byWhat it doesWhere it is available
Connection profileYou (personal setting)Shows the environment with a color and watermark, and confirms or blocks executions with a protection modeAll projects
Dangerous SQL checkAlways on (can be turned off per type on each connection)Asks before running statements that remove a lot of dataAll projects
Role-based DDL restriction and DDL approvalWhoever manages the projectBlocks DDL for chosen roles and routes it through approvalAccount projects
AI and MCP connection policiesWhoever can change the connection's AI settingsDecides what AI and external MCP clients can change and whether they must askAll projects (MCP on desktop)
Database account privilegesThe database administratorAnything the database does not allow is not executed from any toolEvery path, including outside NeoSQL

Telling environments apart with connection profiles

A connection profile shows on screen which environment a connection belongs to, and decides how carefully executions are handled. Open the connection dialog with the Explorer context menuEdit... menu and set it in the Profile tab.

  • A profile is a personal setting. In an account project it is stored in your account, and in a local project in the project on this computer. It does not affect team members.
  • In an account project, team members without permission to edit connections can still open the Profile tab.

Choosing an environment in the Environment option sets the Color, Background watermark and Protection mode options together. You can change each of them afterwards.

EnvironmentColorBackground watermarkProtection mode
LocalTealOffNone
DevBlueOffNone
StagingOrangeOffConfirm (DDL + risky DML)
ProdRedOnConfirm (DDL + risky DML)
CustomYour choiceYour choiceYour choice
  • The chosen color is applied to the work tab badge (1) and to the line on the right of the SQL editor's line number area (2).
  • With the Background watermark option on, the label (3) is laid across the background of the SQL editor and the ERD. If you leave the Label (optional) field empty, the connection name is used.
  • Picking a Color yourself switches the environment to Custom. The protection mode and watermark stay as they are, but SQL session idle timeouts follow the values of the Custom environment.

Protection modes

Protection modeWhat it does
NoneAsks nothing
Confirm (DDL + risky DML)Asks before running DDL (statements starting with CREATE, ALTER, DROP, TRUNCATE, RENAME, GRANT and so on, and a SELECT … INTO that creates a table) and UPDATE or DELETE without WHERE. The confirmation title shows the environment and the connection name
Read-only (block non-SELECT)Does not run statements that are not queries

The protection mode applies to every path inside NeoSQL that writes to the database. Every path uses the same rule and the same confirmation window.

Execution pathProtection mode
The Execute and Run Script buttons in the SQL editorApplies
SQL run by AI AssistantApplies. In the Read-only (block non-SELECT) protection mode, every statement that is not a query is blocked
SQL sent by an external MCP clientApplies. Each statement is checked, and if any one of several statements is blocked, none of them runs
Applying result grid edits (including choosing to apply when closing a tab), applying ERD changes to the database, changing and deleting objects in the explorerApplies. Each screen shows the SQL to be run and then the check runs
Importing data from files, restoring dump filesApplies. With the Read-only (block non-SELECT) protection mode they do not start
  • The Read-only (block non-SELECT) protection mode looks into the body of a statement to decide whether it is a query. Even when a statement starts with SELECT, WITH, SHOW, DESCRIBE or EXPLAIN, a statement that changes data inside WITH, a SELECT … INTO that creates a table, and an EXPLAIN ANALYZE that actually runs the statement are not treated as queries and are blocked.
  • When several statements run at once, each is checked, and if any one is blocked, none of them runs.

Dangerous SQL check

Regardless of the connection profile, the SQL editor asks once more before running the statements below.

StatementConfirmation title
TRUNCATEDangerous Operation
Every statement starting with DROPDangerous Operation
An ALTER that removes something, such as ALTER TABLE … DROP COLUMNDangerous Operation
UPDATE or DELETE without WHERE (including one that starts with WITH)Confirm Execution
  • This check runs when you run with the Execute and Run Script buttons. If there are bind parameters, the statement with the values filled in is checked. The Run Script button gathers the matching statements and asks once before running. It does not run when you edit in the result grid.
  • A WHERE inside a subquery does not filter the target rows, so it does not count as a WHERE.
  • If you check the Don't ask again for this type on this connection option in the confirmation, that type is not asked again on the same connection until you restart the app (or reload the page on the web). Other connections and other projects are not affected.
  • Role-based DDL restriction and the protection mode are checked first, and a statement they block is blocked without asking. On a connection with the Confirm (DDL + risky DML) protection mode, running an UPDATE without WHERE asks both checks in one window. The Don't ask again for this type on this connection option does not turn off the protection mode check.
  • When the confirmation opens, the focus is on the Cancel button. Pressing only Enter does not run the statement.

Role-based DDL restriction and DDL approval in account projects

In an account project you can block DDL per role and have schema changes reviewed by an approver before they run. The project owner sets the DDL Restriction and Approver Role options per role in the Project settingsRole Permissions tab. At first they are off for every role.

When a team member with restricted DDLResult
Runs DDL in the SQL editorIt is not run, and a message asks them to request the approver to apply it to the database
Applies ERD changes to the databaseInstead of running the DDL, they enter a reason and request approval
Runs DDL through AI Assistant or an external MCP clientIt is blocked. A confirmation cannot lift it
  • The approver reviews requests in the Project railDDL Approval panel. The approver can edit the DDL, and clicking the Approve & Execute DDL button runs the DDL right away. The Reject button sends the request back.
  • The people who can approve are the owner and team members whose role has the DDL Restriction item turned off. If the requester's role has an Approver Role item set, only that role or higher approves (DDL approval).
  • Role-based DDL restriction only blocks running DDL in NeoSQL screens. If the connection's database account has DDL privileges, other tools that connect with the same database account are not blocked. Where DDL must be blocked, block it with the database account's privileges (see 'Why a read-only database account is recommended' below).
  • When you turn off the DDL Restriction item for a role and save the settings, the unapplied changes of that role's members are discarded and their pending requests are cancelled. Process the requests you want to keep before turning it off.
  • Sharing and roles are explained in Collaboration and permissions.

AI and MCP connection policies

What AI Assistant and external MCP clients can do on a connection is set per connection in the dialog opened with the AI Settings button at the top of the project screen.

OptionAI AssistantExternal MCP client (desktop)
Enabled offDoes not use the connectionRejects requests for the connection
Schema changes offAsks before running DDLShows the Confirm MCP DDL Execution dialog on the desktop. If you do not answer within 45 seconds, nothing runs
Schema changes onRuns without askingRuns without asking
Data changes offAsks before running INSERT, UPDATE and DELETERuns them without committing and leaves the transaction open in the SQL tab for MCP. You commit or roll back yourself in NeoSQL
Data changes onRuns without askingCommits automatically
  • Role-based DDL restriction and the protection mode take effect before these policies. Even with Schema changes on, DDL does not run for team members with restricted DDL or on connections with the Read-only (block non-SELECT) protection mode, and the Confirm (DDL + risky DML) protection mode still asks.
  • In an account project, only the project owner can change public connections, and only the connection's owner can change a private connection. In a local project, the user of this computer changes them.
  • A connection newly created in a local project has Enabled on, and Schema changes and Data changes off.
  • What is sent to AI is explained in AI and MCP, and the other options of the dialog in Project AI settings.

NeoSQL's safeguards reduce mistakes, but they are not the last wall protecting your database.

  • The dangerous SQL check runs only in the SQL editor. Other paths have only the protection mode.
  • They judge statements by their shape, so a dangerous statement that looks safe, such as one with WHERE 1=1, can get through. The app's own description of DDL restriction also says it cannot block everything and recommends restrictions on the database side as well.
  • The protection mode is a personal setting, so it differs between team members. It has no effect on other tools or applications that use the same database account.

Database account privileges are enforced by the database itself, so they apply equally to every tool and every path. For production databases, do the following.

  • Create connections that only read data with a database account that has only SELECT privileges. Use such a connection when you open a production database to AI or external MCP clients too.
  • Separate the account that changes data from the account that runs DDL, and give DDL privileges only to approvers.
  • Public connections in an account project share one database user and password across the team (Connections and execution targets). The privileges of the account you put in a public connection are the privileges of the whole team that uses it.

Things to keep in mind

  • A connection without a connection profile has the protection mode None. When you create a production connection, set its profile first.
  • Editing in the result grid and applying ERD changes to the database do not go through the dangerous SQL check. On a production database, always check the SQL shown before it runs.
  • When you change data in a production database, turn off the Auto Commit switch, run the statement, check it and then commit. Transactions are explained in SQL execution and transactions.