Prerequisites
- Before proceeding, ensure that MindsDB is installed locally via Docker or Docker Desktop.
- Register an application in the Azure portal.
- Navigate to the Azure Portal and sign in with your Microsoft account.
- Locate the Microsoft Entra ID service and click on it.
- Click on App registrations and then click on New registration.
- Enter a name for your application and select the
Accounts in this organizational directory onlyoption for the Supported account types field. - Keep the Redirect URI field empty and click on Register.
- Click on API permissions and then click on Add a permission.
- Select Microsoft Graph and then click on Delegated permissions.
- Search for the
Files.Readpermission and select it. - Click on Add permissions.
- Request an administrator to grant consent for the above permissions. If you are the administrator, click on Grant admin consent for [your organization] and then click on Yes.
- Copy the Application (client) ID and record it as the
client_idparameter, and copy the Directory (tenant) ID and record it as thetenant_idparameter. - Click on Certificates & secrets and then click on New client secret.
- Enter a description for your client secret and select an expiration period.
- Click on Add and copy the generated client secret and record it as the
client_secretparameter. - Click on Authentication and then click on Add a platform.
- Select Web and enter URL where MindsDB has been deployed followed by
/verify-authin the Redirect URIs field. For example, if you are running MindsDB locally (onhttps://localhost:47334), enterhttps://localhost:47334/verify-authin the Redirect URIs field.
Connection
Establish a connection to Microsoft OneDrive from MindsDB by executing the following SQL command:Note that sample parameter values are provided here for reference, and you should replace them with your connection parameters.
client_id: The client ID of the registered application.client_secret: The client secret of the registered application.tenant_id: The tenant ID of the registered application.
Usage
Retrieve data from a specified file in Microsoft OneDrive by providing the integration name and the file name:The above examples utilize
one_drive_datasource as the datasource name, which is defined in the CREATE DATABASE command.files table can be used to list the files available in Microsoft OneDrive:
content column. This column is empty by default to avoid unnecessary data transfer: