You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-15Lines changed: 34 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -215,7 +215,7 @@ table_name = '<SENSITIVE_DATA_TABLE>' # Replace with your actual table name
215
215
216
216
# Create Insert Request
217
217
insert_request = InsertRequest(
218
-
table_name=table_name,
218
+
table=table_name,
219
219
values=insert_data,
220
220
return_tokens=True, # Optional: Get tokens for inserted data
221
221
continue_on_error=True# Optional: Continue on partial errors
@@ -273,7 +273,7 @@ options = InsertOptions(
273
273
274
274
```python
275
275
insert_request = InsertRequest(
276
-
table_name=table_name, # Replace with the table name
276
+
table=table_name, # Replace with the table name
277
277
values=insert_data,
278
278
return_tokens=False, # Do not return tokens
279
279
continue_on_error=False, # Stop inserting if any record fails
@@ -474,7 +474,7 @@ try:
474
474
475
475
# Step 2: Create Insert Request
476
476
insert_request = InsertRequest(
477
-
table_name='table1', # Specify the table in the vault where the data will be inserted
477
+
table='table1', # Specify the table in the vault where the data will be inserted
478
478
values=insert_data, # Attach the data (records) to be inserted
479
479
return_tokens=True, # Specify if tokens should be returned upon successful insertion
480
480
continue_on_error=True# Optional: Continue on partial errors
@@ -551,7 +551,7 @@ try:
551
551
552
552
# Step 2: Build an InsertRequest object with the table name and the data to insert
553
553
insert_request = InsertRequest(
554
-
table_name='<TABLE_NAME>', # Replace with the actual table name in your Skyflow vault
554
+
table='<TABLE_NAME>', # Replace with the actual table name in your Skyflow vault
555
555
values=insert_data, # Attach the data to be inserted
556
556
)
557
557
@@ -608,7 +608,7 @@ try:
608
608
609
609
# Step 4: Build the InsertRequest object with the data records to insert
610
610
insert_request = InsertRequest(
611
-
table_name='table1', # Specify the table in the vault where the data will be inserted
611
+
table='table1', # Specify the table in the vault where the data will be inserted
612
612
values=insert_data, # Attach the data (records) to be inserted
613
613
return_tokens=True, # Specify if tokens should be returned upon successful insertion
614
614
continue_on_error=True# Specify to continue inserting records even if an error occurs for some records
@@ -686,7 +686,7 @@ try:
686
686
687
687
# Step 3: Build the InsertRequest object with the upsertData
688
688
insert_request = InsertRequest(
689
-
table_name='table1', # Specify the table in the vault where the data will be inserted
689
+
table='table1', # Specify the table in the vault where the data will be inserted
690
690
values=insert_data, # Attach the data (records) to be inserted
691
691
return_tokens=True, # Specify if tokens should be returned upon successful insertion
692
692
upsert='cardholder_name'# Specify the field to be used for upsert operations (e.g., cardholder_name)
@@ -1897,23 +1897,24 @@ ReidentifyTextResponse(
1897
1897
```
1898
1898
1899
1899
### Deidentify File
1900
-
To deidentify files, use the `deidentify_file` method. The `DeidentifyFileRequest` class creates a deidentify file request, which includes the file to be deidentified and various configuration options.
1900
+
To deidentify files, use the `deidentify_file` method. The `DeidentifyFileRequest` class creates a deidentify file request, supports providing either a file or a file path in class FileInput for de-identification, along with various configuration options.
1901
1901
1902
1902
#### Construct a Deidentify File request
1903
1903
```python
1904
1904
from skyflow.error import SkyflowError
1905
1905
from skyflow.utils.enums import DetectEntities, MaskingMethod, DetectOutputTranscriptions
1906
-
from skyflow.vault.detect import DeidentifyFileRequest, TokenFormat, Transformations, Bleep
1906
+
from skyflow.vault.detect import DeidentifyFileRequest, TokenFormat, Transformations, Bleep, FileInput
1907
1907
"""
1908
1908
This example demonstrates how to deidentify file, along with corresponding DeidentifyFileRequest schema.
1909
1909
"""
1910
1910
try:
1911
1911
# Initialize Skyflow client
1912
1912
# Step 1: Open file for deidentification
1913
-
file=open('<FILE_PATH>', 'rb') # Open the file in read-binary mode
1913
+
file_path="<FILE_PATH>"
1914
+
file=open(file_path, 'rb') # Open the file in read-binary mode
1914
1915
# Step 2: Create deidentify file request
1915
1916
request = DeidentifyFileRequest(
1916
-
file=file, # File object to deidentify
1917
+
file=FileInput(file), # File to de-identify (can also provide a file path)
1917
1918
entities=[DetectEntities.SSN, DetectEntities.CREDIT_CARD], # Entities to detect
1918
1919
1919
1920
# Token format configuration
@@ -1971,7 +1972,7 @@ except Exception as error:
1971
1972
```python
1972
1973
from skyflow.error import SkyflowError
1973
1974
from skyflow.utils.enums import DetectEntities, MaskingMethod, DetectOutputTranscriptions
1974
-
from skyflow.vault.detect import DeidentifyFileRequest, TokenFormat, Bleep
1975
+
from skyflow.vault.detect import DeidentifyFileRequest, TokenFormat, Bleep, FileInput
1975
1976
"""
1976
1977
* Skyflow Deidentify File Example
1977
1978
*
@@ -1985,7 +1986,7 @@ try:
1985
1986
file=open('sensitive_document.txt', 'rb') # Open the file in read-binary mode
1986
1987
# Step 2: Create deidentify file request
1987
1988
request = DeidentifyFileRequest(
1988
-
file=file, # File object to deidentify
1989
+
file=FileInput(file), # File to de-identify (can also provide a file path)
1989
1990
entities=[
1990
1991
DetectEntities.SSN,
1991
1992
DetectEntities.CREDIT_CARD
@@ -2038,7 +2039,6 @@ DeidentifyFileResponse(
2038
2039
],
2039
2040
run_id='83abcdef-2b61-4a83-a4e0-cbc71ffabffd',
2040
2041
status='SUCCESS',
2041
-
errors=[]
2042
2042
)
2043
2043
```
2044
2044
@@ -2121,7 +2121,7 @@ except Exception as error:
2121
2121
print('Unexpected Error:', error) # Print the stack trace for debugging purposes
0 commit comments