
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
A Python library to dump, load, and mask data between databases in Alembic-managed environments, with SSH tunnel support.
A Python library to dump, load, and mask data between databases (e.g., PostgreSQL, MySQL) in environments managed by Alembic, with SSH tunnel support.
This tool is designed to help developers synchronize database schemas using Alembic revisions and then transfer data, optionally applying masking rules to sensitive information. It's particularly useful for creating staging or development environments from production data, or for migrating data between different database instances while maintaining schema integrity.
You can install alembic-dump
using pip
:
# Basic installation
pip install alembic-dump
# With AWS Secrets Manager support
pip install alembic-dump[aws]
# With HashiCorp Vault support
pip install alembic-dump[vault]
# With both secret management systems
pip install alembic-dump[aws,vault]
# For development (includes all optional dependencies)
pip install alembic-dump[dev]
from alembic_dump.core import dump_and_load
from alembic_dump.config import AppSettings
# Basic configuration
settings = AppSettings(
source_db={
"driver": "postgresql",
"host": "source.example.com",
"port": 5432,
"username": "source_user",
"password": "source_pass",
"database": "source_db",
},
target_db={
"driver": "postgresql",
"host": "target.example.com",
"port": 5432,
"username": "target_user",
"password": "target_pass",
"database": "target_db",
}
)
# Run the dump and load process
dump_and_load(settings, alembic_dir="path/to/alembic")
Configuration can be provided through environment variables, a .env
file, or directly in code using the AppSettings
class.
from alembic_dump.config import AppSettings
settings = AppSettings(
source_db={
"driver": "postgresql",
"database": "source_db",
"secret_provider_config": {
"provider_type": "aws_secrets_manager",
"secret_id": "arn:aws:secretsmanager:region:account:secret:db-credentials",
"region_name": "us-west-2",
# Optional: role_arn for cross-account access
# "role_arn": "arn:aws:iam::account:role/role-name",
# Optional: profile_name for local AWS credentials
# "profile_name": "my-profile"
},
"secret_key_mapping": {
"host": "db_host",
"port": "db_port",
"username": "db_user",
"password": "db_pass"
}
}
)
from alembic_dump.config import AppSettings
settings = AppSettings(
source_db={
"driver": "postgresql",
"database": "source_db",
"secret_provider_config": {
"provider_type": "hashicorp_vault",
"vault_addr": "https://vault.example.com:8200",
"secret_path": "secret/data/db-credentials",
# Either vault_token or role_id/secret_id must be provided
"vault_token": "s.token",
# "role_id": "role-id",
# "secret_id": "secret-id"
},
"secret_key_mapping": {
"host": "db_host",
"port": "db_port",
"username": "db_user",
"password": "db_pass"
}
}
)
All configuration can also be provided through environment variables:
# Basic configuration
ALEMBIC_DUMP_SOURCE_DB__DRIVER=postgresql
ALEMBIC_DUMP_SOURCE_DB__HOST=source.example.com
ALEMBIC_DUMP_SOURCE_DB__PORT=5432
ALEMBIC_DUMP_SOURCE_DB__USERNAME=source_user
ALEMBIC_DUMP_SOURCE_DB__PASSWORD=source_pass
ALEMBIC_DUMP_SOURCE_DB__DATABASE=source_db
# AWS Secrets Manager configuration
ALEMBIC_DUMP_SOURCE_DB__SECRET_PROVIDER_CONFIG__PROVIDER_TYPE=aws_secrets_manager
ALEMBIC_DUMP_SOURCE_DB__SECRET_PROVIDER_CONFIG__SECRET_ID=arn:aws:secretsmanager:region:account:secret:db-credentials
ALEMBIC_DUMP_SOURCE_DB__SECRET_PROVIDER_CONFIG__REGION_NAME=us-west-2
ALEMBIC_DUMP_SOURCE_DB__SECRET_KEY_MAPPING__HOST=db_host
ALEMBIC_DUMP_SOURCE_DB__SECRET_KEY_MAPPING__PORT=db_port
ALEMBIC_DUMP_SOURCE_DB__SECRET_KEY_MAPPING__USERNAME=db_user
ALEMBIC_DUMP_SOURCE_DB__SECRET_KEY_MAPPING__PASSWORD=db_pass
# HashiCorp Vault configuration
ALEMBIC_DUMP_SOURCE_DB__SECRET_PROVIDER_CONFIG__PROVIDER_TYPE=hashicorp_vault
ALEMBIC_DUMP_SOURCE_DB__SECRET_PROVIDER_CONFIG__VAULT_ADDR=https://vault.example.com:8200
ALEMBIC_DUMP_SOURCE_DB__SECRET_PROVIDER_CONFIG__SECRET_PATH=secret/data/db-credentials
ALEMBIC_DUMP_SOURCE_DB__SECRET_PROVIDER_CONFIG__VAULT_TOKEN=s.token
Clone the repository:
git clone https://github.com/jaeyoung0509/alembic-dump.git
cd alembic-dump
Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
Install development dependencies:
pip install -e ".[dev]"
Run tests:
pytest
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
MIT
FAQs
A Python library to dump, load, and mask data between databases in Alembic-managed environments, with SSH tunnel support.
We found that alembic-dump demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.