Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries ⟶
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    • Affiliate Program
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Extra Tools
  3. SQL Query Console v 20.0
  4. Sales Conditions FAQ

SQL Query Console

by Awins
Odoo
v 20.0 Third Party 12
Download for v 20.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Versions 19.0 20.0
You bought this module and need support? Click here!
Versions 19.0 20.0
  • Description
  • Manifest
Apps / Awins / sql_query_console

SQL Query Console

Save SQL queries in the backend, run them read-only with one click, see the rows on the form and download them as CSV or Excel.

Install›Configure›Use
/odoo/action-sql_query_console.action_sql_query/6
SQL Query Console in the Odoo backend
Odoo19.0, 20.0
EditionsCommunity, Enterprise
Works withBase and Discuss (mail)
LicenceLGPL-3, free
Tests10 automated, run on every version
Modulesql_query_console

The situation

Someone asks how many contacts per country have an email, or which tables take the most space. The answer is one SELECT away, but running it means a psql session on the server, or a console app where a stray DELETE or DROP goes straight to the database.

With this module you keep those queries in Settings › Technical › SQL Console and click Run. A SELECT or WITH query runs inside a savepoint with transaction_read_only on, and the savepoint is always rolled back. Statements that change data are refused unless the user has the Write Queries group and the query has Allow Write Statements ticked. Every run lands in a run log and in the chatter.

What it adds

Run
Read-only by default
SELECT and WITH queries run in a savepoint with transaction_read_only on, then roll back. A data-modifying CTE or a function that writes fails instead of changing data.
Without it: Other SQL console apps run DELETE, UPDATE and DROP as soon as you click.
Write Queries
Two keys for writes
INSERT, UPDATE, DELETE and DDL run only for users in SQL Console / Write Queries, on a query with Allow Write Statements ticked. Everyone else gets a Rejected message and nothing runs.
One statement
No statement chaining
A second statement after a ';' is refused, as are COMMIT, ROLLBACK, SAVEPOINT, SET and COPY, so a query can't end the transaction or step out of its savepoint. Semicolons inside strings, quoted names, dollar quotes and comments are fine.
Row Limit
Row limit and timeout
Each query has a Row Limit (500 by default) and a Timeout (s) (30 by default). The form tells you when the limit cut the result; a slow query is cancelled by statement_timeout and logged as an error.
Result
Result table on the form
The rows show as a table under the query, with NULL marked. Every cell and column name is HTML-escaped, so a value that contains HTML or a script tag is shown as plain text.
Export CSV
CSV and XLSX export
Export CSV and Export XLSX download the last result and keep the file as an attachment on the query, named after the query and the run time.
Visible to Groups
Saved queries per group
A query with groups set is only visible to users in one of them. Leave it empty and every console user sees it.
SQL Run Log
Run log and chatter
Each run stores user, time, mode, rows, duration, the SQL and the error, also for rejected runs. A note goes to the query's chatter too.

Getting started

Install

Open Apps, clear the Apps filter, search for SQL Query Console and click Activate. It depends on base and mail. The menu sits under Settings › Technical, so turn on developer mode to see it; only Settings administrators can open it.

Apps › sql_query_console › Activate
Configure

Nothing to set for read-only use. If someone has to run write statements, open their user in Settings › Users & Companies › Users and set SQL Console to Write Queries in the Access Rights tab. They still have to tick Allow Write Statements on each query that may write.

Settings › Users & Companies › Users › Access Rights › SQL Console Settings for SQL Query Console
Use

Open Settings › Technical › SQL Console › Queries, click New, give the query a name, paste the SQL and click Run. The rows show on the Result tab with the run time and the number of rows. Export CSV or Export XLSX downloads them. Run it again any time: the Runs button and SQL Run Log show who ran what and when.

A DELETE on a query without Allow Write Statements is rejected before it reaches the database, and the rejection is logged.
A DELETE on a query without Allow Write Statements is rejected before it reaches the database, and the rejection is logged.
SQL Run Log: every run with user, mode, rows, duration and the error for failed or rejected runs.
SQL Run Log: every run with user, mode, rows, duration and the error for failed or rejected runs.

Fine print

Can a read-only query still change something?
Writes to tables are blocked by PostgreSQL itself: the query runs with transaction_read_only on and is rolled back afterwards. Functions that act outside the transaction, such as pg_terminate_backend or pg_cancel_backend, are not writes and are not blocked, which is why the console is for Settings administrators only.
How does a write query run?
In its own savepoint without the read-only flag. If it succeeds the savepoint is kept and the ORM cache is cleared; if it fails, only that savepoint is rolled back. The form shows how many rows were affected, and the log marks the run as Write.
Does the row limit make big queries cheap?
For SELECT and WITH the query is wrapped in SELECT * FROM (...) LIMIT row_limit + 1, so PostgreSQL stops after the limit when the plan allows it. A query that sorts or groups a big table still does that work; use the timeout to cap it.
Where can I run it?
On Odoo.sh and on your own server, Community or Enterprise, versions 19.0 and 20.0. Odoo Online doesn't accept third-party modules.
What doesn't it do?
It runs plain SQL only: no parameters, no charts, no scheduled runs and no email of results. One statement per run. Only Settings administrators see the menu; there is no read-only console for ordinary users. The result shown and exported is capped by the row limit, and the last result is stored on the query, so don't use it for data you would not keep in the database.
Can you adapt it for us?
Yes. Email odoo.expert.111@gmail.com with your Odoo version and what you'd like changed.

Log

20.0.1.0.0 · Nov 2026
First release, published for Odoo 19.0 and 20.0.

Need a query turned into a report or a scheduled export?

Write to us with the query and what you need from it.

Email odoo.expert.111@gmail.com
QR code: email Awins about this module

Also by Awins

Leave Bulk Approval Leave Bulk Approval leave_bulk_approval
Expense Policy Rules Expense Policy Rules expense_policy_rules
Equipment Issue & Return Equipment Issue & Return equipment_issue_signoff
Awins builds small Odoo modules that do one job. sql_query_console · 20.0.1.0.0
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 492
Technical Name sql_query_console
LicenseLGPL-3

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with