How to Configure JetBrains AI SQL Server Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a jetbrains ai sql server prevent delete rule by limiting database user rights. You assign a read-only role or deny write permissions on the target database. Engineering teams often connect IDE assistants using personal or shared admin accounts. When a database account has broad rights, a generated query can wipe out live rows. How native jetbrains ai sql server prevent delete roles work SQL Server controls what an IDE assistant can run through logins and database users. A database

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up a jetbrains ai sql server prevent delete rule by limiting database user rights. You assign a read-only role or deny write permissions on the target database. Engineering teams often connect IDE assistants using personal or shared admin accounts. When a database account has broad rights, a generated query can wipe out live rows.

How native jetbrains ai sql server prevent delete roles work

SQL Server controls what an IDE assistant can run through logins and database users. A database user is the identity of a login inside a specific database. When someone needs many databases on one instance, admins create a login in master. For one or a few databases, a contained database user with a password works well. An admin must enable contained databases on the server and database first. SQL Server supports thirteen different types of database users for various login setups.

Once the user exists, admins assign fixed database roles to block delete actions. You cannot change the permissions built into these fixed database roles. Every role, including the public role, holds the basic permission to connect. Members of the db_datareader role can read all data from user tables and views. If the IDE only needs to inspect data, this role blocks all changes.

Sometimes an engineer needs to insert rows with AI help while blocking row removal. The fixed db_datawriter role allows a user to add, change, or delete table data. Because db_datawriter bundles these three actions together, it cannot stop deletes on its own. Instead, admins can use custom roles that grant insert rights and deny delete rights. Alternatively, the db_denydatawriter role stops a user from adding, changing, or deleting any data. Admins should avoid the db_owner role for AI tools. Members of db_owner can run all maintenance tasks and even drop the whole database.

Why static database roles fall short in daily work

Native roles decide who can log in and which broad actions that account holds. They work well when a tool only ever needs to read tables. Still, developers use IDE assistants for many tasks across the same work day. An engineer might ask the assistant to draft a select query at nine. At ten, that same engineer might need to update a staging record.

AI Data Exfiltration Prevention + SQL Injection Prevention: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To avoid switching accounts, developers often log in with their main work credentials. Those accounts usually hold write permissions or full owner rights on the database. Native roles cannot inspect a single query in flight to check its intent. If the account has delete permissions, the database runs the delete statement right away. Static roles also do not rewrite sensitive fields like emails or phone numbers in results. When a query runs, the database returns every column the user can read by default.

Managing shared accounts and schema changes

Maintaining custom table permissions across dozens of databases creates heavy work for database admins. Every time a team adds a new table, admins must check the custom roles. If someone forgets a deny rule on a new table, delete actions can slip through. Shared service accounts make this problem worse by hiding which person ran a query. In the database log, every action from that shared login looks the same. Teams need a way to inspect individual commands without managing complex role trees.

Check SQL Server batches and results on the wire

SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server. It reads plain batches and parameterized queries on the TDS wire while passing Windows login through untouched.

Before a batch hits the server, hoop.dev guardrails check the statement against your rules. Disallowed actions get a native TDS error with your message. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns that match your rules. Every query and decision is logged. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can the db_datawriter role block delete statements by itself?

No, the fixed db_datawriter role lets members add, change, and delete data in all user tables. You cannot change the permissions inside a fixed database role. To allow inserts while blocking deletes, you must assign custom permissions instead.

What does the db_denydatawriter role do in SQL Server?

The db_denydatawriter role stops a database user from adding, changing, or deleting any table data. Admins pair it with read roles to ensure an account cannot change rows. It overrides write permissions that a user might get from other roles.

Why is the db_owner role risky for IDE assistants?

Members of the db_owner role can run all setup and maintenance tasks in the database. They can delete any table row and even drop the entire database in SQL Server. Using this role in an IDE assistant exposes live data to accidental loss.

The query runs. The emails stay hidden.