Python SDK: Migrate from V1 to V2
Python SDK: Migrate from V1 to V2
Python SDK: Migrate from V1 to V2
Skyflow Python SDK v2 introduces a new authentication model, multi-vault support, typed request and response classes, and richer error diagnostics. This guide walks through the key changes with before-and-after code examples, focuses on Insert end-to-end, then shows how the same pattern applies to other operations. A final section covers the smaller v2.1+ changes that are backward compatible.
V1 required a token provider function. V2 lets you choose from five credential types.
V1:
V2:
Use only one authentication method per credentials object.
V2 introduces a builder pattern for client initialization and adds multi-vault support. Log levels are now per-instance instead of global.
V1:
V2 (single vault):
V2 (multiple vaults):
Key changes:
vault_url is replaced by cluster_id (derived from your vault URL).env is now required. Supported values: Env.PROD, Env.SANDBOX.set_log_level().V2 replaces the dict-based request payload with a typed InsertRequest. Responses are returned as typed InsertResponse objects.
V1:
V2:
V1 response:
V2 response:
Every vault operation in v2 follows the same pattern: build a typed request, then pass it to a method on the vault client. The snippets below show v2 request construction; the v1 patterns mirrored the dict-based shape used by client.insert() in v1.
Get:
Update:
Delete:
Detokenize:
Query:
V2 moves request options onto the request constructor itself instead of a separate InsertOptions object.
V1:
V2:
The same pattern applies to the other request classes: UpsertRequest, UpdateRequest, DeleteRequest, and GetRequest all accept their options directly as constructor parameters.
V2 errors carry more context to help with debugging.
V1:
V2:
Use the request_id field when contacting Skyflow Support — it uniquely identifies the request for faster diagnosis.
v2.1.0 introduces a small set of backward-compatible changes. Existing v2.0 code continues to work; deprecated forms emit a deprecation warning.
Method renames:
Detokenize redaction parameter:
The redaction key in detokenize requests is deprecated in favor of redaction_type. Both keys are accepted; if both are provided, redaction_type takes precedence.
FileUploadRequest positional arguments:
Positional arguments on FileUploadRequest(table, skyflow_id, column_name) are deprecated. Use keyword arguments instead.
Credential field aliases:
Credential JSON files now accept both legacy and new field names. Existing files continue to work unchanged.
New errors field on Detect responses:
DeidentifyFileResponse, DeidentifyTextResponse, and ReidentifyTextResponse now include an errors field alongside their existing response data.
For the full list of changes, see the Python SDK releases on GitHub.
If you hit issues during migration, contact Skyflow Support and include the request_id from any failed call.