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 Workbench: Read-only SQL Console, Saved Queries, Export CSV Excel PDF v 17.0
  4. Sales Conditions FAQ

SQL Query Workbench: Read-only SQL Console, Saved Queries, Export CSV Excel PDF

by Viyug Infotech https://viyuginfotech.com
Odoo
v 17.0 Third Party 53
Download for v 17.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Versions 16.0 17.0 18.0 19.0 20.0
You bought this module and need support? Click here!
Versions 16.0 17.0 18.0 19.0 20.0
  • Description
  • Manifest
SQL Query Workbench

Ask your database anything. Change nothing.

A SQL console for administrators that can only read: one SELECT, WITH or EXPLAIN at a time, on its own read-only connection, with a timeout and a row cap, always rolled back. Save queries with typed parameters, browse the schema, read query plans and export to CSV, Excel or PDF.

Read onlyTyped parametersSchema browserExplain plansCSV, Excel, PDF

3
protection layers
9
parameter types
10
example queries
3
export formats

Read-only by design, not by promise

Every run passes three independent checks. A statement that slips past one is stopped by the next.

1

Statement check

Exactly one SELECT, WITH or EXPLAIN. Write and DDL keywords, COPY, SET, transaction control, file and backend functions, and blocked tables or columns are refused before anything reaches PostgreSQL. Comments and quoted text cannot hide a second statement.

2

Read-only transaction

The query runs on a separate read-only connection, inside SET TRANSACTION READ ONLY with a statement timeout and a lock timeout. Even nextval() fails, and a slow query is cancelled by PostgreSQL itself.

3

Always rolled back

The transaction is rolled back after every run, success or error. Parameter values are bound by the database driver and never pasted into the SQL text.

SQL reads raw data: Odoo record rules and field access do not apply. The console says so on screen, access is limited to a dedicated group, and credential-like columns are masked.

What you get

Everything an administrator needs to answer a data question in minutes, and to hand the answer to colleagues safely.

💻

Console with SQL highlighting

Ctrl+Enter runs, a selection runs alone, the draft is kept per user. Open saved queries by tag or recall a recent run.

📊

Results grid

Row numbers, sticky header, column types, sorting, pagination, a filter box, hide and reorder columns, NULL highlighting, sum and average footer.

🔗

Open the real record

id and many2one columns read from an Odoo table link to the record form. Override the column-to-model mapping per saved query.

🗂

Schema browser

Tables with row estimate and size, columns with SQL type and Odoo field label, indexes and foreign keys. Insert a name or a ready SELECT into the editor.

📈

Explain plan view

A readable plan tree with estimated and actual rows, time and cost share. Sequential scans on large tables are flagged. EXPLAIN ANALYZE stays read-only.

💾

Saved queries

Name, notes, tags and SQL, validated by a read-only dry run before they can be shared. SQL changes are tracked in the chatter.

🎛

Typed parameters

Date, date and time, number, text, yes/no, selection, record and record list, with labels, required flags and defaults like start of month or fiscal year.

👥

Share and publish

Share with groups or users: they run, they do not edit and do not see the SQL. Publish a query as a menu with a parameter form and export buttons.

📤

CSV, Excel and PDF

CSV with separator, quote, header, BOM and line endings. Excel with real dates and numbers, frozen header and autofilter. PDF in portrait or landscape.

✉️

Email digests

Send a saved query daily, weekly or monthly as Excel or CSV to users and contacts, skipping empty results if you like.

📝

History and run log

Every run is logged with user, duration, rows, status, error and parameters. List, pivot and graph views, and a retention job.

🛡

Safety settings

Row cap, timeout and export limit, with overrides per group. Blocked tables and columns, and masking of password, token and key columns.

📦

Query library

Export saved queries with parameters and sharing groups to a JSON file and import them into another database.

🏢

Multi-company

Saved queries and run logs carry a company. Built-in values :company_id and :company_ids follow the companies selected by the user.

💡

Ten example queries

Largest tables, installed modules, scheduled actions, the email queue and more, ready to run and copy.

See it working

Screens from a demo database with fictional contacts and companies.

1

The console

Editor with SQL highlighting, schema browser on the left and the results grid with the type under each column name, row count and run time. A reminder that SQL reads raw data sits under the editor.

The console
2

Open a saved or recent query

Start a new query, pick a saved one filtered by tag, or recall one of your recent runs.

Open a saved or recent query
3

Grid tools

A typed parameter box, hide and reorder columns, sorting, quick filter, NULL highlighting and copy.

Grid tools
4

Schema browser

Columns with SQL type, Odoo field label and target model. The password column is masked in the grid, NULL values are highlighted.

Schema browser
5

Explain plan

Estimated and actual rows, time and cost share per step. A sequential scan on a large table is flagged in yellow.

Explain plan
6

Errors in place

The PostgreSQL message and hint appear under the editor and the line is marked. No traceback.

Errors in place
7

Writes are refused

An UPDATE never reaches the database. Only SELECT, WITH and EXPLAIN can run.

Writes are refused
8

Saved queries

Tags, owner, sharing, run count and state, with a Run button on each line.

Saved queries
9

Typed parameters

Dates with dynamic defaults, a country record list, a yes/no and a selection, each bound by the driver.

Typed parameters
10

Run screen for colleagues

A published query opens a parameter form and the results. Run-only users never see the SQL.

Run screen for colleagues
11

Sharing and menus

Share a validated query with groups or users and publish it as a menu entry under SQL Reports.

Sharing and menus
12

Change tracking

Every change to the SQL, parameters and sharing is written to the chatter.

Change tracking
13

Email digest

Choose the interval, file format and recipients. The digest runs as the owner with the parameter defaults.

Email digest
14

CSV options

File name, separator, quote character, line endings, header row and UTF-8 BOM for spreadsheet tools.

CSV options
15

PDF output

A printable result with company header, row count and parameters, in portrait or landscape.

PDF output
16

Run log analysis

Average and slowest duration and failure count per query, as a pivot, list or graph.

Run log analysis
17

Settings

Row cap, timeout, export limit, group limits, blocked tables and columns, and masking.

Settings

Configuration

Settings > SQL Workbench. Defaults are safe; change them only if you need to.

SettingDefaultWhat it does
Row cap2,000 rowsRows fetched per run in the grid. Larger results are cut and flagged.
Statement timeout30 secondsPostgreSQL cancels a query that runs longer, EXPLAIN ANALYZE included.
Max export rows100,000 rowsRows written to CSV, Excel and digest files.
Limits per groupnoneHigher or lower limits for chosen groups. Members get the largest value.
Blocked tablessystem parameters, API keys, two-factor devices, mail servers and moreQueries naming these tables are refused.
Blocked columnspassword, totp_secret, smtp_passQueries naming these columns are refused, and their values read as ******** in every query, whole-row and JSON reads included.
Mask credential-like columnsonText columns named like password, secret, token or api_key read as ******** inside every query and in results.
Keep run log90 daysOlder runs are deleted every night. 0 keeps them.
Flag sequential scans10,000 rowsPlan view highlights full scans of tables at least this large.
AccessCan do
SQL Workbench / AdministratorGiven to every Settings administrator. Edits every saved query, shares and publishes, schedules digests, sees the full run log and the settings.
SQL Workbench / User: run read-only SQLConsole, schema browser, own saved queries and own history. Grant only to people you trust with raw data.
Groups you share withRun the shared, validated queries from a menu or the list. No console, no SQL text, no editing.

Going further with AI

Our paid apps build on the same idea of safe, reviewed access to your data. Explore their full specifications on their own pages.

AI Connection Layer icon
AI Connection Layer Paid app

One place for your AI provider, API key, request log with token usage, monthly budget and validated answers, shared by all AI apps in the database.

View AI Connection Layer
AI Data Repair Studio icon
AI Data Repair Studio Paid app

Find duplicate partners and broken product data, preview each repair, apply only what a manager approves, and roll back.

View AI Data Repair Studio

Questions

Can a query change data?

No. Only one SELECT, WITH or EXPLAIN statement is accepted, it runs in a READ ONLY transaction on a separate connection, and the transaction is always rolled back. Functions with side effects, such as nextval() or file access, fail or are refused.

Who can use it?

Settings administrators by default. You can also give the SQL Workbench User role to a trusted person. Everyone else sees only the queries shared with them, without the SQL.

Do Odoo access rules apply to the results?

No. SQL reads the tables directly, so record rules, field groups and company filters are not applied. That is why access is limited and why sensitive tables and columns are blocked or masked. The console shows this warning under the editor.

What happens with a slow query?

PostgreSQL cancels it at the statement timeout (30 seconds by default) and the run is logged as a timeout. Results above the row cap are cut and flagged.

How do parameters work?

Write :date_from in the SQL and declare it as a date. The run form shows a date picker with the default you chose, and the value is passed to the database driver separately from the SQL. :user_id, :company_id, :company_ids, :today and :lang are filled in for you.

Can colleagues run my queries without seeing SQL?

Yes. Validate the query, share it with a group and optionally publish it as a menu. Members get a parameter form, the results and export buttons.

Does it create views or tables in the database?

No. Nothing is created in PostgreSQL. Saved queries are ordinary Odoo records.

Does it work on Odoo.sh or a managed database?

Yes. It needs no database superuser and no extra PostgreSQL role. It uses the connection Odoo already has.

Which apps does it need?

Only Discuss, for the chatter and email digests.

Need help or a change?

Questions, a query you cannot get right, or a feature you would like? Viyug Infotech will get back to you.

Email support: support@viyuginfotech.com
Website: viyuginfotech.com

Scan with your phone to chat on WhatsApp or write us an email:

WhatsApp QR code for Viyug Infotech support

WhatsApp

+91 83207 42187

Email QR code for Viyug Infotech support

Email

Send us an email

Release notes

Initial release

  • Read-only console with schema browser, plan view and results grid
  • Saved queries with typed parameters, validation, sharing, menus and email digests
  • CSV, Excel and PDF export, run log and query library
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 3856
Technical Name sql_query_workbench
LicenseLGPL-3
Websitehttps://viyuginfotech.com

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