Problem/Motivation

Currently, the Database Browser module allows users to inspect and browse
database tables directly from the Drupal admin interface. However, there is
no functionality to export database table data or query results into commonly
used file formats.

Users currently need external tools such as phpMyAdmin, Adminer, or custom SQL
scripts to export database data for reporting, backups, debugging, analytics,
or data migration purposes.

Adding export functionality would improve usability and reduce dependency on
external database management tools.

Steps to reproduce

  1. Install and enable the Database Browser module
  2. Navigate to a database table view page
  3. Attempt to export table data
  4. Observe that no export functionality exists
  5. User must rely on external database tools for exporting data

Proposed resolution

Add export functionality for database tables and query results.

Proposed functionality:

  • Allow exporting table data directly from the admin UI
  • Support multiple export formats:
    • CSV
    • SQL
    • Excel (XLSX)
    • JSON
  • Allow exporting filtered and sorted results
  • Support exporting query results from the readonly SQL console
  • Add download response handling
  • Limit export size for performance protection
  • Add permission-based access control

Potential future enhancements:

  • Compressed ZIP exports
  • Scheduled exports
  • Email export delivery
  • Streaming large exports

Remaining tasks

  • Create export service
  • Add export buttons/actions to table pages
  • Implement CSV export generator
  • Implement SQL dump generator
  • Implement Excel export support
  • Add JSON export support
  • Add access permissions
  • Add export validation and limits
  • Write automated tests
  • Update README documentation

User interface changes

New export actions will be added to database table pages.

UI additions may include:

  • Export dropdown/button
  • Format selection options
  • Download confirmation
  • Export progress/status messages

API changes

New export-related services may be introduced:

  • Database export service
  • File generation service
  • Export formatter plugins

Possible future extensibility:

  • Custom export format plugins
  • Alter export output hooks
  • Custom export handlers

Data model changes

No database schema changes are currently proposed.

Optional future enhancements:

  • Export history tracking
  • Saved export configurations
  • Export audit logging
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

oshi02 created an issue. See original summary.

mohnish s. yadav made their first commit to this issue’s fork.

mohnish s. yadav’s picture

Status: Active » Needs review

Summary

Adds export functionality for database tables and readonly SQL query results
in the Database Browser module.

Implemented Features

  • Added export support for:
    • CSV
    • JSON
    • SQL
    • XLSX
  • Added export functionality for:
    • Database table data
    • Readonly SQL query results
  • Added support for:
    • Filtered exports
    • Sorted exports
    • Downloadable file responses
  • Added configurable export row limits through module settings.
  • Added permission-based access control for exports.

New Components

Controllers

  • Added ExportController for handling export responses.

Services

  • Added ExportManager
  • Added exporter services:
    • CsvExporter
    • JsonExporter
    • SqlExporter
    • XlsxExporter

Forms

  • Added DatabaseBrowserSettingsForm

Configuration

Added module configuration for:

  • Maximum export rows

Security

  • Readonly SQL query validation is enforced before query exports.
  • Export limits are enforced for performance protection.

Documentation

Updated README with:

  • Export usage
  • Configuration
  • Supported formats
  • SQL console usage
  • Architecture overview

Testing

Manually tested:

  • CSV exports
  • JSON exports
  • SQL exports
  • XLSX exports
  • Table exports
  • Query exports
  • Filtered exports
  • Sorted exports
  • Export limits
  • Permission handling
oshi02’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.