dataflow.utils.vault_migration_script¶

Fixed Vault Reference Migration Script.

This script migrates API keys and secrets to the vault schema, using proper schema mapping with the existing table() helper function.

Functions¶

add_vault_helper_functions()

Add helper functions to resolve vault references.

create_vault_secret(name, description[, value])

Create a new secret in the vault.

ensure_vault_reference_column(table_name)

Ensure the table has a vault_reference column for secret references.

execute_sql(sql)

Execute SQL safely through Supabase RPC function.

get_existing_vault_secrets()

Get existing vault secrets to avoid duplicates.

main()

Main function to run the migration.

migrate_component_env_mappings()

Migrate component_env_mappings to include vault references.

migrate_engine_api_keys()

Migrate engine API keys to vault references.

migrate_environment_variables()

Migrate config.environment_variables to use vault references.

migrate_provider_api_keys()

Migrate provider API keys to vault references.

Module Contents¶

dataflow.utils.vault_migration_script.add_vault_helper_functions()¶

Add helper functions to resolve vault references.

Returns:

True if successful, False if SQL should be run manually

Return type:

bool

dataflow.utils.vault_migration_script.create_vault_secret(name, description, value=None)¶

Create a new secret in the vault.

Parameters:
  • name (str)

  • description (str)

  • value (str | None)

Return type:

str | None

dataflow.utils.vault_migration_script.ensure_vault_reference_column(table_name)¶

Ensure the table has a vault_reference column for secret references. Uses table() helper function for proper schema resolution.

Parameters:

table_name (str) – Full table name including schema

Returns:

True if column exists or was created, False otherwise

Return type:

bool

dataflow.utils.vault_migration_script.execute_sql(sql)¶

Execute SQL safely through Supabase RPC function.

Parameters:

sql (str)

Return type:

Any

dataflow.utils.vault_migration_script.get_existing_vault_secrets()¶

Get existing vault secrets to avoid duplicates.

Return type:

dict[str, str]

dataflow.utils.vault_migration_script.main()¶

Main function to run the migration.

dataflow.utils.vault_migration_script.migrate_component_env_mappings()¶

Migrate component_env_mappings to include vault references.

Returns:

Number of mappings migrated

Return type:

int

dataflow.utils.vault_migration_script.migrate_engine_api_keys()¶

Migrate engine API keys to vault references.

Returns:

Number of engines with API keys migrated

Return type:

int

dataflow.utils.vault_migration_script.migrate_environment_variables()¶

Migrate config.environment_variables to use vault references.

Returns:

Number of environment variables migrated

Return type:

int

dataflow.utils.vault_migration_script.migrate_provider_api_keys()¶

Migrate provider API keys to vault references.

Returns:

Number of providers migrated

Return type:

int