Using Boto3 from Databricks Cluster with FGAC¶
- Prev Connector Guide
Databricks Clusters BOTO3 Use-Case¶
This section describes how to use the AWS SDK (Boto3) to enforce access control on AWS S3 file data through a Privacera Dataserver Proxy.
Prerequisites¶
Make sure to check with your Databricks administrator regarding Privacera DataServer port before proceeding with the following steps.
- Ensure that you have an existing Databricks account with login credentials that grant sufficient privileges to manage your Databricks cluster.
- Databricks should be connected to Privacera Manager.
- Obtain the Access KeyandSecret Keyfrom Privacera Manager using one of the following methods:- To generate a new Privacera token, navigate to the Privacera portal and go to Launch Pad -> Privacera Token -> GENERATE TOKEN
 
- URL endpointfor the Privacera Manager Dataserver.
- Please ensure that you possess an existing Databricks account with login credentials that grant sufficient privileges to manage your Databricks cluster.
- Databricks should be connected to PrivaceraCloud.
- Obtain the Access KeyandSecret Keyfrom PrivaceraCloud using one of the following methods:- To generate a new Privacera token, navigate to the Privacera portal and go to Launch Pad -> Privacera Tokens -> GENERATE TOKEN
- To use an valid existing token, navigate to the Privacera portal and go to Launch Pad → Setup AWS Cli → DOWNLOAD TOKEN
 
- URL endpointof the PrivaceraCloud Dataserver.
Setup¶
Follow the steps recommended by Databricks to install the Boto3 library in your Databricks cluster.
Here are the steps for your reference
| Python | |
|---|---|
In your Databricks notebook, you can use the following code to access S3 files using Boto3:
Import the required libraries
| Python | |
|---|---|
Access the S3 files
Make sure to replace following values with your actual values.
| Text Only | |
|---|---|
| 1 2 3 4 5 6 7 |  | 
Make sure the bucket name and file path are correct and the file exists
Output
-  Without read permission to the S3 path you would get the following error 
-  With appropriate read permission to the S3 path you would get the following output 
- Prev Connector Guide