Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ec98d8f
SK-2504: Add support for custom tokenUri (#228)
saileshwar-skyflow Jan 27, 2026
3294b09
[AUTOMATED] Private Release 2.0.0.dev0+ec98d8f
saileshwar-skyflow Jan 27, 2026
af0b616
SK-2496: extract hard coded values to constants
skyflow-himanshu Jan 28, 2026
d17e71d
SK-2496: addressed review comments and suggestions
skyflow-himanshu Feb 2, 2026
5eb3da9
SK-2496: added samples to ignore for linting
skyflow-himanshu Feb 2, 2026
fbfaaa3
Merge pull request #229 from skyflowapi/himanshu/2496-update-linting-…
skyflow-himanshu Feb 3, 2026
449b191
[AUTOMATED] Private Release 2.0.0.dev0+fbfaaa3
skyflow-himanshu Feb 3, 2026
17399ea
SK-2522: Fix Python SDK v2 issues reported in Bug Bash (#231)
saileshwar-skyflow Feb 5, 2026
9bcdfe0
[AUTOMATED] Private Release 2.0.0.dev0+17399ea
saileshwar-skyflow Feb 5, 2026
1c26b2e
SK-2526: Upgrate urllib3 and setuptools libraries (#233) (#234)
saileshwar-skyflow Feb 6, 2026
e33ae92
SK-2548 fix config validation (#235)
skyflow-bharti Feb 19, 2026
87cf3ae
[AUTOMATED] Private Release 2.0.0.dev0+e33ae92
skyflow-bharti Feb 19, 2026
f7d26df
SK-2645: Merge branch 'release/26.1.0' into release/26.1.4
saileshwar-skyflow Mar 24, 2026
bbeeeaf
[AUTOMATED] Private Release 2.0.0.dev0+f7d26df
saileshwar-skyflow Mar 24, 2026
e564e92
SK-2813: Python SDK v2 — code quality, security hardening, and messag…
saileshwar-skyflow May 20, 2026
63c49d2
[AUTOMATED] Private Release 2.0.2.dev0+e564e92
saileshwar-skyflow May 20, 2026
c12dfd5
SK-2833: update change log file (#246)
saileshwar-skyflow May 20, 2026
4f58c35
SK-2838: use SDK logger for deprecation warnings instead of Python wa…
saileshwar-skyflow May 21, 2026
4ea39dd
[AUTOMATED] Private Release 2.0.2.dev0+4f58c35
saileshwar-skyflow May 21, 2026
961116e
SK-2838: fix redaction type in detokenize interface (#249)
saileshwar-skyflow May 21, 2026
5345434
[AUTOMATED] Private Release 2.0.2.dev0+961116e
saileshwar-skyflow May 21, 2026
06b9b38
SK-2838: add deprecated samples
saileshwar-skyflow May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 2 additions & 159 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,162 +1,5 @@
# Changelog

All notable changes to this project will be documented in this file.
All notable changes to this project will be documented as part of the release notes.

## [1.15.1] - 2023-12-07
## Fixed
- Not receiving tokens when calling Get with options tokens as true.

## [1.15.0] - 2023-10-30
## Added
- options tokens support for Get method.

## [1.14.0] - 2023-09-29
## Added
- Support for different BYOT modes in Insert method.

## [1.13.1] - 2023-09-14
### Changed
- Add `request_index` in responses for insert method.

## [1.13.0] - 2023-09-04
### Added
- Added new Query method.

## [1.12.0] - 2023-09-01
### Added
- Support for Bulk request with Continue on Error in Detokenize Method
- Support for Continue on Error in Insert Method

## [1.11.0] - 2023-08-25
### Added
- Support for BYOT in Insert method.

## [1.10.1] - 2023-07-28
### Fixed
- Fixed delete method

## [1.10.0] - 2023-07-21
### Added
- Added delete method

## [1.9.2] - 2023-06-22
### Fixed
- Multiple record error in get method

## [1.9.1] - 2023-06-07
### Fixed
- Fixed bug in metrics

## [1.9.0] - 2023-06-07
### Added
- Added redaction type in detokenize

## [1.8.1] - 2023-03-17
### Removed
- removed grace period logic in bearer token generation

## [1.8.0] - 2023-01-10
### Added
- update and get methods.

## [1.7.0] - 2022-12-07
### Added
- `upsert` support for insert method.

## [1.6.2] - 2022-06-28

### Added
- Copyright header to all files
- Security email in README

## [1.6.1] - 2022-05-17

### Fixed

- Insert with multiple records returning invalid output

## [1.6.0] - 2022-04-12

### Added

- support for application/x-www-form-urlencoded and multipart/form-data content-type's in connections.

## [1.5.1] - 2022-03-29

### Added

- Validation to token obtained from `tokenProvider`

### Fixed

- Request headers not getting overridden due to case sensitivity

## [1.5.0] - 2022-03-22

### Changed

- `getById` changed to `get_by_id`
- `invokeConnection`changed to `invoke_connection`
- `generateBearerToken` changed to `generate_bearer_token`
- `generateBearerTokenDromCreds` changed to `generate_bearer_token_from_creds`
- `isExpired` changed to `is_expired`
- `setLogLevel` changed to `set_log_level`

### Removed

- `isValid` function
- `GenerateToken` function

## [1.4.0] - 2022-03-15

### Changed

- deprecated `isValid` in favour of `isExpired`

## [1.3.0] - 2022-02-24

### Added

- Request ID in error logs and error responses for API Errors
- Caching to accessToken token
- `isValid` method for validating Service Account bearer token

## [1.2.1] - 2022-01-18

### Fixed

- `generateBearerTokenFromCreds` raising error "invalid credentials" on correct credentials

## [1.2.0] - 2022-01-04

### Added

- Logging functionality
- `setLogLevel` function for setting the package-level LogLevel
- `generateBearerTokenFromCreds` function which takes credentials as string

### Changed

- Renamed and deprecated `GenerateToken` in favor of `generateBearerToken`
- Make `vaultID` and `vaultURL` optional in `Client` constructor

## [1.1.0] - 2021-11-10

### Added

- `insert` vault API
- `detokenize` vault API
- `getById` vault API
- `invokeConnection`

## [1.0.1] - 2021-10-26

### Changed

- Package description

## [1.0.0] - 2021-10-19

### Added

- Service Account Token generation
See [Github](https://github.com/skyflowapi/skyflow-python/releases) or [PyPI](https://pypi.org/project/skyflow/#history) for more details on each released version.
92 changes: 79 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Skyflow Python SDK

> **This is the current, recommended version of the Skyflow SDK.** V2.1.0 brings flexible auth, multi-vault support, native data types, and rich error diagnostics.
>
> Migrating from v1? See the **[Migration Guide](https://github.com/skyflowapi/skyflow-python/blob/main/docs/migrate_to_v2.md)** for step-by-step instructions. V1 is in maintenance mode and will reach End of Life on October 31, 2026.

The Skyflow Python SDK is designed to help with integrating Skyflow into a Python backend.

## Table of Contents
Expand Down Expand Up @@ -235,8 +239,8 @@ from skyflow.utils.enums import RedactionType

detokenize_request = DetokenizeRequest(
data=[
{'token': 'token1', 'redaction': RedactionType.PLAIN_TEXT},
{'token': 'token2', 'redaction': RedactionType.PLAIN_TEXT}
{'token': 'token1', 'redaction_type': RedactionType.PLAIN_TEXT},
{'token': 'token2', 'redaction_type': RedactionType.PLAIN_TEXT}
],
continue_on_error=True
)
Expand Down Expand Up @@ -406,21 +410,36 @@ Refer to [Query your data](https://docs.skyflow.com/query-data/) and [Execute Qu

### Upload File

Upload files to a Skyflow vault using the `upload_file` method. Create a file upload request with the `FileUploadRequest` class, which accepts parameters such as the table name, column name, and Skyflow ID.
Upload files to a Skyflow vault using the `upload_file` method. Create a file upload request with the `FileUploadRequest` class.

**Upload a file to an existing record:**

```python
from skyflow.vault.data import FileUploadRequest

# Open the file in binary read mode
with open('path/to/file.pdf', 'rb') as file_obj:
upload_request = FileUploadRequest(
table='documents', # Table name
column_name='attachment', # Column name to store file
skyflow_id='<SKYFLOW_ID>', # Skyflow ID of the record
file_object=file_obj # Pass file object
table='<TABLE_NAME>',
column_name='<COLUMN_NAME>',
skyflow_id='<SKYFLOW_ID>',
file_object=file_obj
)

# Perform File Upload

response = skyflow_client.vault('<VAULT_ID>').upload_file(upload_request)
print('File upload:', response)
```

**Upload a file and create a new record (omit `skyflow_id`):**

```python
with open('path/to/file.pdf', 'rb') as file_obj:
upload_request = FileUploadRequest(
table='documents',
column_name='attachment',
file_object=file_obj
)

response = skyflow_client.vault('<VAULT_ID>').upload_file(upload_request)
print('File upload:', response)
```
Expand Down Expand Up @@ -703,18 +722,65 @@ options = {

Embed context values into a bearer token during generation so you can reference those values in your policies. This enables more flexible access controls, such as tracking end-user identity when making API calls using service accounts, and facilitates using signed data tokens during detokenization.

Generate bearer tokens containing context information using a service account with the context_id identifier. Context information is represented as a JWT claim in a Skyflow-generated bearer token. Tokens generated from such service accounts include a context_identifier claim, are valid for 60 minutes, and can be used to make API calls to the Data and Management APIs, depending on the service account's permissions.
Generate bearer tokens containing context information using a service account with the `context_id` identifier. Context information is represented as a JWT claim in a Skyflow-generated bearer token. Tokens generated from such service accounts include a `context_identifier` claim, are valid for 60 minutes, and can be used to make API calls to the Data and Management APIs, depending on the service account's permissions.

The `ctx` parameter accepts either a **string** or a **dict**:

**String context** — use when your policy references a single context value:

```python
options = {'ctx': 'user_12345'}
token, _ = generate_bearer_token(filepath, options)
```

**Dict context** — use when your policy needs multiple context values for conditional data access. Each key in the dict maps to a Skyflow CEL policy variable under `request.context.*`:

```python
options = {
'ctx': {
'role': 'admin',
'department': 'finance',
'user_id': 'user_12345',
}
}
token, _ = generate_bearer_token(filepath, options)
```

With the dict above, your Skyflow policies can reference `request.context.role`, `request.context.department`, and `request.context.user_id` to make conditional access decisions.

Dict keys must contain only alphanumeric characters and underscores (`[a-zA-Z0-9_]`). Invalid keys will raise a `SkyflowError`.

> [!TIP]
> See the full example in the samples directory: [token_generation_with_context_example.py](samples/service_account/token_generation_with_context_example.py)
> See [docs.skyflow.com](https://docs.skyflow.com) for more details on authentication, access control, and governance for Skyflow.
> See the full example in the samples directory: [token_generation_with_context_example.py](samples/service_account/token_generation_with_context_example.py)
> See Skyflow's [context-aware authorization](https://docs.skyflow.com) and [conditional data access](https://docs.skyflow.com) docs for policy variable syntax like `request.context.*`.

#### Generate signed data tokens: `generate_signed_data_tokens(filepath, options)`

Digitally sign data tokens with a service account's private key to add an extra layer of protection. Skyflow generates data tokens when sensitive data is inserted into the vault. Detokenize signed tokens only by providing the signed data token along with a bearer token generated from the service account's credentials. The service account must have the necessary permissions and context to successfully detokenize the signed data tokens.

The `ctx` parameter on signed data tokens also accepts either a **string** or a **dict**, using the same format as bearer tokens:

```python
# String context
options = {
'ctx': 'user_12345',
'data_tokens': ['dataToken1', 'dataToken2'],
'time_to_live': 90,
}

# Dict context
options = {
'ctx': {
'role': 'analyst',
'department': 'research',
},
'data_tokens': ['dataToken1', 'dataToken2'],
'time_to_live': 90,
}
```

> [!TIP]
> See the full example in the samples directory: [signed_token_generation_example.py](samples/service_account/signed_token_generation_example.py)
> See the full example in the samples directory: [signed_token_generation_example.py](samples/service_account/signed_token_generation_example.py)
> See [docs.skyflow.com](https://docs.skyflow.com) for more details on authentication, access control, and governance for Skyflow.

## Logging
Expand Down
5 changes: 3 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ exclude = [
"venv",
"build",
"dist",
"tests"
"tests",
"samples"
]

line-length = 120

[lint]
select = ["N"]
select = ["N", "PLR2004"]

[lint.pep8-naming]
Loading
Loading