Skip to main content
You can export query results from SQL Editor in two ways:

Direct export

Members whose role includes bb.sql.export click Export on a query result. Like query access, Bytebase checks bb.sql.export against the databases the query reads, and against schemas and tables when the role is scoped to them. See Export data for formats, row limits, and query re-execution. SQL Editor User and SQL Editor Read User do not include bb.sql.export. To let someone query and export without running DDL or DML, grant SQL Editor Exporter, or add bb.sql.export to a custom role.

Just-in-time data export

To put exports behind approval, assign roles without bb.sql.export, such as SQL Editor Read User. SQL Editor hides Export on their results. When Allow access grants is on for the project, they can request an access grant instead:
  1. Click Request export on the query result. The Request access grant drawer opens with Export pre-checked. You can also check Export in any access grant request. request-data-export
  2. The approver sees on the request issue that the grant allows exporting the result. export-request-issue
  3. Once approved, run the approved statement and export its result before the grant expires.
Every data-export request stays visible in the Access Grants list on the SQL Editor left sidebar (the shield icon). Filter by export: Yes to show only export grants, and re-request expired grants from there. export-grant-list

Export destinations

By default, Export downloads the result to your machine. When the project has a SharePoint folder, you can upload straight to SharePoint instead. See Export to SharePoint.

Turn off downloads

A Workspace Admin or Workspace DBA can turn off local downloads to keep SQL Editor exports in company storage:
  1. Go to Settings > General.
  2. In the SQL Editor section, turn off Allow downloading exports, and click Update. Allow downloading exports
When Allow downloading exports is off, a project needs a SharePoint folder before anyone can export from SQL Editor.