Install
Use this section to install, configure, and validate the Python SDK for Protegrity Synthetic Data.
Prerequisites
Ensure that the pip is available in your active Python virtual environment.
Overview
The Synthetic Data service can be accessed programmatically using the Python SDK.
1. Install the Synthetic Data Python SDK
Install the SDK from PyPI using the version that matches the deployed Synthetic Data service.
Using pip:
pip install protegrity-synthetic-data-sdk>=2.0.0
2. Configure the SDK
Create a client configuration pointing to your PPC gateway. The gateway URL can be obtained using:
export GATEWAY_URL="https://$(kubectl get configmap/nfa-config -n default -o jsonpath='{.data.FQDN}')"
Then configure the client in Python:
from synthetic_data_sdk.config import ClientConfig
config = ClientConfig(
base_url="<GATEWAY_URL>/pty/syntheticdata/v2",
username="<USERNAME>",
password="<PASSWORD>",
verify_ssl=True,
)
Note: Replace default credentials and URLs for production environments. For example, for
<USERNAME>, entersyntheticdata_adminand for<PASSWORD>, enterStrongPassword123!.
3. Test the Synthetic Data Python SDK
from synthetic_data_sdk import SyntheticDataClient
from synthetic_data_sdk.config import ClientConfig
config = ClientConfig(
base_url="<GATEWAY_URL>/pty/syntheticdata/v2",
username="<USERNAME>",
password="<PASSWORD>",
verify_ssl=True,
)
with SyntheticDataClient(config=config) as client:
print("Connection established successfully.")
The connection is established successfully. If the connection fails, an error message is displayed.
Feedback
Was this page helpful?