Data exchange agent for migrations and validation
Project description
Snowflake Data Exchange Agent
A REST API service for database migrations and data validation. Supports multiple databases including Snowflake, PostgreSQL, and SQL Server with queue-based task processing.
Quick Start
# Install
pip install snowflake-data-exchange-agent
# Run
data-exchange-agent --port 8080
# Test
curl http://localhost:8080/health
Installation
From PyPI (Production)
pip install snowflake-data-exchange-agent
Requirements & Dependencies
Python Version: 3.10, 3.11, or 3.12 (3.13 not yet supported)
Available dependency groups:
development: Testing and development tools (pytest, ruff, etc.)all: Includes all development dependencies
Core dependencies include:
- Snowflake Connector for Python
- PySpark for data processing
- Flask + Waitress for REST API
- PostgreSQL support (psycopg2-binary)
- AWS SDK (boto3)
Configuration
Create src/data_exchange_agent/configuration.toml:
selected_task_source = "api"
[application]
workers = 4
task_fetch_interval = 120
debug_mode = false
[task_source.api]
key = "api-key"
[connections.source.<sqlserver|postgresql|teradata>]
username = "username"
password = "password"
database = "database_name"
host = "127.0.0.1"
port = <1433|5432|1025>
[connections.target.snowflake_connection_name]
connection_name = "connection_name"
[connections.target.s3]
profile_name = "profile_name"
bucket_name = "bucket_name"
[connections.target.blob]
connection_string = "DefaultEndpointsProtocol=https;AccountName=account_name;AccountKey=account_key;EndpointSuffix=core.windows.net"
container_name = "container_name"
# Optional: Account name and use_default_credential if not using connection string
account_name="storage_account_name"
use_default_credential=<True|False>
For Snowflake, create ~/.snowflake/config.toml:
[connections.default]
account = "your_account.region"
user = "your_username"
password = "your_password"
warehouse = "COMPUTE_WH"
database = "PRODUCTION_DB"
API Usage
Command Line
# Basic usage
data-exchange-agent
# Production settings
data-exchange-agent --workers 8 --port 8080
# Debug mode
data-exchange-agent --debug --port 5001
Health Check
GET /health
{
"status": "healthy",
"version": "0.0.18",
"database_connections": {
"snowflake": "connected"
}
}
Task Management
# Start processing
GET /handle_tasks
# Stop processing
GET /stop
# Get status
GET /get_handling_tasks_status
# Task count
GET /get_tasks_count
Add Task
POST /tasks
Content-Type: application/json
{
"task_type": "data_extraction",
"source_config": {
"database": "postgresql",
"query": "SELECT * FROM users"
},
"destination_config": {
"type": "snowflake_stage",
"stage": "@data_stage/users/"
}
}
Development
Setup
git clone https://github.com/snowflakedb/migrations-data-validation.git
cd migrations-data-validation/data-exchange-agent
pip install -e .[development]
Testing
# Run all tests
pytest
# With coverage
pytest --cov=src/data_exchange_agent
# Run specific test types
pytest tests/unit/ # Unit tests only
pytest -m "not integration" # Non-integration tests
Code Quality
# Format code
ruff format .
# Lint code
ruff check .
# Auto-fix linting issues
ruff check --fix .
🤝 Contributing
We welcome contributions! See our Contributing Guide for details on how to collaborate, set up your development environment, and submit PRs.
📄 License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
🆘 Support
- Documentation: Full documentation
- Issues: GitHub Issues
Developed with ❄️ by Snowflake
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snowflake_data_exchange_agent-1.0.0.tar.gz.
File metadata
- Download URL: snowflake_data_exchange_agent-1.0.0.tar.gz
- Upload date:
- Size: 108.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51bdb9a79d23d29f869bf0b977ac3f54613c810df6e89f8f2cccf6f866e8f8ed
|
|
| MD5 |
ed69a33964b7ea43ca5d204d91f7cbd4
|
|
| BLAKE2b-256 |
5a562084dd2c1adcf4b0871fceee9f32a561f1a3831f2574702555b08daa6b4d
|
File details
Details for the file snowflake_data_exchange_agent-1.0.0-py3-none-any.whl.
File metadata
- Download URL: snowflake_data_exchange_agent-1.0.0-py3-none-any.whl
- Upload date:
- Size: 83.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ccd2953a55b9c287cc84c8363c4d061e4341bd215d747cb6a79f185676ce621
|
|
| MD5 |
c775631aee2e9534f84d9cbffbafd233
|
|
| BLAKE2b-256 |
45050a360628c3fe24cc9f9151e1f2684bdc13fbee6444961cf15a8bac3e3cdf
|