Magento 2 SQL Report Builder

Table of Contents

  1. Extension Installation
  2. Manage SQL Report
  3. Add New SQL Report
  4. Execute SQL Query & Generate Report
  5. Save SQL Report

 

  1. Extension Installation
  • For Magento Marketplace Customers
    • Find the Composer name and version of the extension in the extension’s composer.json file.
    • Login to your SSH and run:
    • composer require meetanshi/magento-2-sql-report-builder
    • Enter your authentication keys. Your public key is your username; your private key is your password.
    • Wait for Composer to finish updating your project dependencies and make sure there aren’t any errors.
    • To verify that the extension installed properly, run the command:
      • php bin/magento module:status Meetanshi_SqlReport
          • By default, the extension is probably disabled.
          • Enable the extension and clear static view files:
      • php bin/magento module:enable Meetanshi_SqlReport --clear-static-content
      • php bin/magento setup:upgrade
      • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
      • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
      • php bin/magento cache:flush
         
  • For Meetanshi Customers
  • Extract the zip folder and upload our extension to the root of your Magento 2 directory via FTP.
  • Login to your SSH and run below commands step by step:
  • php bin/magento setup:upgrade
  • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
  • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
  • php bin/magento cache:flush
  1. Manage SQL Report

Go to SQL Report Builder à Manage SQL Reports, where you can manage all the saved SQL reports. The grid displays all the saved report titles along with their SQL queries. The drop-down menu in the action provides options to edit or delete the existing SQL reports.

You can also add new SQL report by clicking on the ‘Add New SQL Report’ button on the top-right corner.

  1. Add New SQL Report

To add a new SQL report, click on the ‘Add New SQL Report’ button from the Manage SQL Reports grid. Here you can configure the following details about the SQL Report:

  • Report Title: Enter the title for the SQL Report.
  • SQL Query: Enter custom SQL query that you want to execute to generate the required report.

Click “Execute SQL Query” button to run the SQL query and generate the report.

  1. Execute SQL Query and Generate Report
    On clicking the ‘Execute SQL Query’ button on the ‘Add SQL Report’ or ‘Edit SQL Report’ page, the extension runs the query, fetches the tables, and displays them in the grid. You can also export the generate report to CSV file by clicking on the ‘Export’ button.

  1. Save SQL Report

Click on the ‘Save SQL Report’ button on the top-right corner of the page to save the report for future use. Once the report is successfully saved, it is added to the list of the SQL reports, which can be used later.

The admin can easily use the saved SQL queries to generate reports by going to the ‘edit’ page from the options provided in the action column and following the steps same as we followed for adding new a SQL report.