Skip to main content
SQL Editor can upload exports straight into a SharePoint document library instead of downloading them to a user’s machine. Your SharePoint administrators control who can read those files and how long to keep them.
Available only for:
  • Enterprise plan
  • Self-hosted Bytebase
Microsoft and Bytebase administrators split the setup:

Register a Microsoft Entra application

Bytebase authenticates to Microsoft Graph with the Lists.SelectedOperations.Selected application permission. That permission grants no access on its own; the application can reach only the libraries you grant it in the next step.
  1. In the Microsoft Entra admin center, go to App registrations and click New registration.
  2. Enter a name such as Bytebase Export, keep Accounts in this organizational directory only, and click Register. Leave Redirect URI blank.
  3. On the application’s Overview page, copy the Application (client) ID and the Directory (tenant) ID.
  4. Go to API permissions, click Add a permission > Microsoft Graph > Application permissions, select Lists.SelectedOperations.Selected, and click Add permissions.
  5. Click Grant admin consent for your tenant.
  6. Go to Certificates & secrets > Client secrets, click New client secret, choose an expiration, and click Add. Copy the secret’s Value right away; Entra shows it only once.

Grant the application access to a library

Grant the application the write role on each document library that projects will export to. Microsoft documents the grant in Overview of Selected permissions in OneDrive and SharePoint and Create permission on a list. Make these Microsoft Graph requests as a SharePoint administrator, for example in Graph Explorer.
  1. Look up the site ID. Open the library in SharePoint and check its URL. The site path is everything before the library name. In https://contoso.sharepoint.com/sites/Finance/Shared%20Documents/Forms/AllItems.aspx, the site is /sites/Finance and the library is Shared Documents. Request the site, using /teams/ instead of /sites/ for a team site:
    The id in the response is the site ID.
  2. Look up the library’s list ID:
    Find the library by its webUrl.
  3. Create the permission:

Configure SharePoint in Bytebase

  1. Go to Integration > Export Destinations and click Configure on the SharePoint row. Export Destinations page
  2. Enter the Tenant ID, Client ID, and Client secret, then click Save. SharePoint configuration

Set a project’s SharePoint folder

Each project can point to one SharePoint library root or folder.
  1. Open the project and go to Settings.
  2. Under Security & Policy > Export destinations, paste the SharePoint URL of the library or folder into the SharePoint field. Project export destination
  3. Click Update.

Export query results to SharePoint

  1. Run a query in SQL Editor and click Export on the result.
  2. The Export Data drawer selects SharePoint by default. Switch Destination to Download if you want a local file and your workspace allows it. Export Data drawer
  3. Choose Export rows and Export format, then click Confirm.
Bytebase runs the statement again, uploads the files, and opens Exported to SharePoint. Click Open in SharePoint to go to the export’s folder. Exported to SharePoint Each export creates its own folder under the project’s SharePoint folder, named after the UTC export time, the exporter’s email, the database, and a random export ID:
In a batch query, each database gets its own folder. SharePoint exports follow the same row limits, formats, and masking as downloads.