snowflake-data-exchange-agent 0.0.19__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snowflake_data_exchange_agent-0.0.19/.gitignore +126 -0
- snowflake_data_exchange_agent-0.0.19/PKG-INFO +248 -0
- snowflake_data_exchange_agent-0.0.19/README.md +194 -0
- snowflake_data_exchange_agent-0.0.19/pyproject.toml +186 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/__init__.py +8 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/__version__.py +23 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/api/__init__.py +6 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/api/manager.py +102 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/config.py +22 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/configuration_example.toml +22 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/constants/__init__.py +6 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/constants/container.py +3 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/constants/manager.py +4 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/constants/paths.py +72 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/constants/snow_api.py +8 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/constants/task.py +12 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/constants/types.py +8 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/container.py +43 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/custom_exceptions.py +7 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/__init__.py +6 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/database_engines.py +79 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/dataset_result_sizes.py +22 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/export_data.py +82 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/extractor.py +52 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/jdbc_jar.py +125 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/jdbc_jar_dict.py +148 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/num_partitions.py +295 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/pyspark.py +268 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/sf_connection.py +105 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/sql_command_type.py +28 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/data_sources/sql_parser.py +71 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/enums/task_status.py +17 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/interfaces/__init__.py +6 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/interfaces/data_source.py +90 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/interfaces/task_queue.py +148 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/interfaces/uploader.py +101 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/interfaces/wsgi_server.py +17 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/main.py +69 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/providers/storageProvider.py +74 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/queues/__init__.py +6 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/queues/deque_task_queue.py +155 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/queues/sqlite_task_queue.py +369 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/servers/__init__.py +6 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/servers/flask_app.py +234 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/servers/waitress_app.py +64 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/tasks/__init__.py +6 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/tasks/manager.py +282 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/uploaders/amazon_s3_uploader.py +89 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/uploaders/azure_blob_uploader.py +166 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/uploaders/sf_stage_uploader.py +78 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/utils/__init__.py +11 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/utils/decorators.py +112 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/utils/file_system.py +69 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/utils/sf_logger.py +190 -0
- snowflake_data_exchange_agent-0.0.19/src/data_exchange_agent/utils/toml.py +92 -0
- snowflake_data_exchange_agent-0.0.19/tests/README.md +200 -0
- snowflake_data_exchange_agent-0.0.19/tests/__init__.py +0 -0
- snowflake_data_exchange_agent-0.0.19/tests/constants/test_paths.py +259 -0
- snowflake_data_exchange_agent-0.0.19/tests/constants/test_snow_api.py +42 -0
- snowflake_data_exchange_agent-0.0.19/tests/data_sources/test_num_partitions.py +554 -0
- snowflake_data_exchange_agent-0.0.19/tests/data_sources/test_sql_parser.py +266 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_amazon_s3_uploader.py +279 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_api_manager.py +201 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_azure_blob_uploader.py +381 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_config.py +70 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_constants.py +117 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_container.py +146 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_data_sources_interfaces.py +263 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_deque_task_queue.py +257 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_enums.py +96 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_extractor.py +216 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_flask_app.py +358 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_integration.py +346 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_jdbc_jar.py +341 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_jdbc_jar_dict.py +350 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_main.py +180 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_pyspark_data_source.py +283 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_runner.py +79 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_sf_stage_uploader.py +310 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_sqlite_task_queue.py +449 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_storage_provider.py +264 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_task_manager.py +617 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_uploader_interface.py +218 -0
- snowflake_data_exchange_agent-0.0.19/tests/test_waitress_app.py +178 -0
- snowflake_data_exchange_agent-0.0.19/tests/utils/test_decorators.py +281 -0
- snowflake_data_exchange_agent-0.0.19/tests/utils/test_sf_logger.py +421 -0
- snowflake_data_exchange_agent-0.0.19/tests/utils/test_toml.py +464 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[codz]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
share/python-wheels/
|
|
20
|
+
*.egg-info/
|
|
21
|
+
.installed.cfg
|
|
22
|
+
*.egg
|
|
23
|
+
MANIFEST
|
|
24
|
+
|
|
25
|
+
*.manifest
|
|
26
|
+
*.spec
|
|
27
|
+
|
|
28
|
+
pip-log.txt
|
|
29
|
+
pip-delete-this-directory.txt
|
|
30
|
+
|
|
31
|
+
htmlcov/
|
|
32
|
+
.tox/
|
|
33
|
+
.nox/
|
|
34
|
+
.coverage
|
|
35
|
+
.coverage.*
|
|
36
|
+
.cache
|
|
37
|
+
nosetests.xml
|
|
38
|
+
coverage.xml
|
|
39
|
+
*.cover
|
|
40
|
+
*.py.cover
|
|
41
|
+
.hypothesis/
|
|
42
|
+
.pytest_cache/
|
|
43
|
+
cover/
|
|
44
|
+
|
|
45
|
+
*.mo
|
|
46
|
+
*.pot
|
|
47
|
+
|
|
48
|
+
*.log
|
|
49
|
+
local_settings.py
|
|
50
|
+
db.sqlite3
|
|
51
|
+
db.sqlite3-journal
|
|
52
|
+
|
|
53
|
+
instance/
|
|
54
|
+
.webassets-cache
|
|
55
|
+
|
|
56
|
+
.scrapy
|
|
57
|
+
|
|
58
|
+
docs/_build/
|
|
59
|
+
|
|
60
|
+
.pybuilder/
|
|
61
|
+
target/
|
|
62
|
+
|
|
63
|
+
.ipynb_checkpoints
|
|
64
|
+
|
|
65
|
+
profile_default/
|
|
66
|
+
ipython_config.py
|
|
67
|
+
|
|
68
|
+
.pdm-python
|
|
69
|
+
.pdm-build/
|
|
70
|
+
.pixi
|
|
71
|
+
__pypackages__/
|
|
72
|
+
|
|
73
|
+
celerybeat-schedule
|
|
74
|
+
celerybeat.pid
|
|
75
|
+
|
|
76
|
+
*.rdb
|
|
77
|
+
*.aof
|
|
78
|
+
*.pid
|
|
79
|
+
|
|
80
|
+
mnesia/
|
|
81
|
+
rabbitmq/
|
|
82
|
+
rabbitmq-data/
|
|
83
|
+
activemq-data/
|
|
84
|
+
|
|
85
|
+
*.sage.py
|
|
86
|
+
|
|
87
|
+
.env
|
|
88
|
+
.envrc
|
|
89
|
+
.venv
|
|
90
|
+
env/
|
|
91
|
+
venv/
|
|
92
|
+
ENV/
|
|
93
|
+
env.bak/
|
|
94
|
+
venv.bak/
|
|
95
|
+
|
|
96
|
+
.spyderproject
|
|
97
|
+
.spyproject
|
|
98
|
+
.ropeproject
|
|
99
|
+
|
|
100
|
+
/site
|
|
101
|
+
|
|
102
|
+
.mypy_cache/
|
|
103
|
+
.dmypy.json
|
|
104
|
+
dmypy.json
|
|
105
|
+
.pyre/
|
|
106
|
+
.pytype/
|
|
107
|
+
|
|
108
|
+
cython_debug/
|
|
109
|
+
.abstra/
|
|
110
|
+
.ruff_cache/
|
|
111
|
+
.pypirc
|
|
112
|
+
|
|
113
|
+
marimo/_static/
|
|
114
|
+
marimo/_lsp/
|
|
115
|
+
__marimo__/
|
|
116
|
+
|
|
117
|
+
.streamlit/secrets.toml
|
|
118
|
+
|
|
119
|
+
.DS_Store
|
|
120
|
+
.AppleDouble
|
|
121
|
+
.LSOverride
|
|
122
|
+
._*
|
|
123
|
+
|
|
124
|
+
configuration.toml
|
|
125
|
+
src/mocked_api/*
|
|
126
|
+
*.code-workspace
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snowflake-data-exchange-agent
|
|
3
|
+
Version: 0.0.19
|
|
4
|
+
Summary: Data exchange agent for migrations and validation
|
|
5
|
+
Project-URL: Bug Tracker, https://github.com/snowflakedb/migrations-data-validation/issues
|
|
6
|
+
Project-URL: Source code, https://github.com/snowflakedb/migrations-data-validation/
|
|
7
|
+
Project-URL: homepage, https://www.snowflake.com/
|
|
8
|
+
Author-email: "Snowflake, Inc." <snowflake-python-libraries-dl@snowflake.com>
|
|
9
|
+
License: Apache License, Version 2.0
|
|
10
|
+
Keywords: Snowflake,analytics,cloud,data,data-analysis,data-analytics,data-engineering,data-management,data-processing,data-science,data-visualization,data-warehouse,database
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Environment :: Other Environment
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: Intended Audience :: Information Technology
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: SQL
|
|
22
|
+
Classifier: Topic :: Database
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
24
|
+
Classifier: Topic :: Software Development
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: <3.13,>=3.10
|
|
29
|
+
Requires-Dist: azure-identity
|
|
30
|
+
Requires-Dist: azure-storage-blob
|
|
31
|
+
Requires-Dist: boto3
|
|
32
|
+
Requires-Dist: dependency-injector
|
|
33
|
+
Requires-Dist: flask
|
|
34
|
+
Requires-Dist: psutil
|
|
35
|
+
Requires-Dist: psycopg2-binary
|
|
36
|
+
Requires-Dist: pyspark
|
|
37
|
+
Requires-Dist: requests>=2.28.0
|
|
38
|
+
Requires-Dist: snowflake-connector-python>=3.0.0
|
|
39
|
+
Requires-Dist: sqlparse
|
|
40
|
+
Requires-Dist: toml
|
|
41
|
+
Requires-Dist: urllib3>=2.5.0
|
|
42
|
+
Requires-Dist: waitress
|
|
43
|
+
Provides-Extra: all
|
|
44
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'all'
|
|
45
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == 'all'
|
|
46
|
+
Requires-Dist: pytest>=7.0.0; extra == 'all'
|
|
47
|
+
Requires-Dist: ruff>=0.1.0; extra == 'all'
|
|
48
|
+
Provides-Extra: development
|
|
49
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'development'
|
|
50
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == 'development'
|
|
51
|
+
Requires-Dist: pytest>=7.0.0; extra == 'development'
|
|
52
|
+
Requires-Dist: ruff>=0.1.0; extra == 'development'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# Snowflake Data Exchange Agent
|
|
56
|
+
|
|
57
|
+
[](http://www.apache.org/licenses/LICENSE-2.0.txt)
|
|
58
|
+
[](https://www.python.org/downloads/)
|
|
59
|
+
|
|
60
|
+
A REST API service for database migrations and data validation. Supports multiple databases including Snowflake, PostgreSQL, and SQL Server with queue-based task processing.
|
|
61
|
+
|
|
62
|
+
## Quick Start
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Install
|
|
66
|
+
pip install snowflake-data-exchange-agent
|
|
67
|
+
|
|
68
|
+
# Run
|
|
69
|
+
data-exchange-agent --port 8080
|
|
70
|
+
|
|
71
|
+
# Test
|
|
72
|
+
curl http://localhost:8080/health
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
### From PyPI (Production)
|
|
78
|
+
```bash
|
|
79
|
+
pip install snowflake-data-exchange-agent
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Requirements & Dependencies
|
|
83
|
+
|
|
84
|
+
**Python Version**: 3.10, 3.11, or 3.12 (3.13 not yet supported)
|
|
85
|
+
|
|
86
|
+
**Available dependency groups**:
|
|
87
|
+
- `development`: Testing and development tools (pytest, ruff, etc.)
|
|
88
|
+
- `all`: Includes all development dependencies
|
|
89
|
+
|
|
90
|
+
**Core dependencies include**:
|
|
91
|
+
- Snowflake Connector for Python
|
|
92
|
+
- PySpark for data processing
|
|
93
|
+
- Flask + Waitress for REST API
|
|
94
|
+
- PostgreSQL support (psycopg2-binary)
|
|
95
|
+
- AWS SDK (boto3)
|
|
96
|
+
|
|
97
|
+
## Configuration
|
|
98
|
+
|
|
99
|
+
Create `src/data_exchange_agent/configuration.toml`:
|
|
100
|
+
|
|
101
|
+
```toml
|
|
102
|
+
# API settings
|
|
103
|
+
[api_configuration]
|
|
104
|
+
key = "your-api-key"
|
|
105
|
+
host = "0.0.0.0"
|
|
106
|
+
port = 5001
|
|
107
|
+
workers = 4
|
|
108
|
+
|
|
109
|
+
# Database connections
|
|
110
|
+
[connection.postgresql]
|
|
111
|
+
driver_name = "postgresql"
|
|
112
|
+
username = "user"
|
|
113
|
+
password = "password"
|
|
114
|
+
host = "localhost"
|
|
115
|
+
port = 5432
|
|
116
|
+
database = "mydb"
|
|
117
|
+
|
|
118
|
+
# Task queue
|
|
119
|
+
[task_queue]
|
|
120
|
+
type = "sqlite"
|
|
121
|
+
database_path = "~/.data_exchange_agent/tasks.db"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
For Snowflake, create `~/.snowflake/config.toml`:
|
|
125
|
+
|
|
126
|
+
```toml
|
|
127
|
+
[connections.default]
|
|
128
|
+
account = "your_account.region"
|
|
129
|
+
user = "your_username"
|
|
130
|
+
password = "your_password"
|
|
131
|
+
warehouse = "COMPUTE_WH"
|
|
132
|
+
database = "PRODUCTION_DB"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## API Usage
|
|
136
|
+
|
|
137
|
+
### Command Line
|
|
138
|
+
```bash
|
|
139
|
+
# Basic usage
|
|
140
|
+
data-exchange-agent
|
|
141
|
+
|
|
142
|
+
# Production settings
|
|
143
|
+
data-exchange-agent --workers 8 --port 8080
|
|
144
|
+
|
|
145
|
+
# Debug mode
|
|
146
|
+
data-exchange-agent --debug --port 5001
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Health Check
|
|
150
|
+
```http
|
|
151
|
+
GET /health
|
|
152
|
+
```
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"status": "healthy",
|
|
156
|
+
"version": "0.0.18",
|
|
157
|
+
"database_connections": {
|
|
158
|
+
"snowflake": "connected"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Task Management
|
|
164
|
+
```http
|
|
165
|
+
# Start processing
|
|
166
|
+
GET /handle_tasks
|
|
167
|
+
|
|
168
|
+
# Stop processing
|
|
169
|
+
GET /stop
|
|
170
|
+
|
|
171
|
+
# Get status
|
|
172
|
+
GET /get_handling_tasks_status
|
|
173
|
+
|
|
174
|
+
# Task count
|
|
175
|
+
GET /get_tasks_count
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Add Task
|
|
179
|
+
```http
|
|
180
|
+
POST /tasks
|
|
181
|
+
Content-Type: application/json
|
|
182
|
+
```
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"task_type": "data_extraction",
|
|
186
|
+
"source_config": {
|
|
187
|
+
"database": "postgresql",
|
|
188
|
+
"query": "SELECT * FROM users"
|
|
189
|
+
},
|
|
190
|
+
"destination_config": {
|
|
191
|
+
"type": "snowflake_stage",
|
|
192
|
+
"stage": "@data_stage/users/"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Development
|
|
198
|
+
|
|
199
|
+
### Setup
|
|
200
|
+
```bash
|
|
201
|
+
git clone https://github.com/snowflakedb/migrations-data-validation.git
|
|
202
|
+
cd migrations-data-validation/data-exchange-agent
|
|
203
|
+
pip install -e .[development]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Testing
|
|
207
|
+
```bash
|
|
208
|
+
# Run all tests
|
|
209
|
+
pytest
|
|
210
|
+
|
|
211
|
+
# With coverage
|
|
212
|
+
pytest --cov=src/data_exchange_agent
|
|
213
|
+
|
|
214
|
+
# Run specific test types
|
|
215
|
+
pytest tests/unit/ # Unit tests only
|
|
216
|
+
pytest -m "not integration" # Non-integration tests
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Code Quality
|
|
220
|
+
```bash
|
|
221
|
+
# Format code
|
|
222
|
+
ruff format .
|
|
223
|
+
|
|
224
|
+
# Lint code
|
|
225
|
+
ruff check .
|
|
226
|
+
|
|
227
|
+
# Auto-fix linting issues
|
|
228
|
+
ruff check --fix .
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## 🤝 Contributing
|
|
232
|
+
|
|
233
|
+
We welcome contributions! See our [Contributing Guide](../CONTRIBUTING.md) for details on how to collaborate, set up your development environment, and submit PRs.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 📄 License
|
|
238
|
+
|
|
239
|
+
This project is licensed under the Apache License 2.0. See the [LICENSE](../LICENSE) file for details.
|
|
240
|
+
|
|
241
|
+
## 🆘 Support
|
|
242
|
+
|
|
243
|
+
- **Documentation**: [Full documentation](https://github.com/snowflakedb/migrations-data-validation)
|
|
244
|
+
- **Issues**: [GitHub Issues](https://github.com/snowflakedb/migrations-data-validation/issues)
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
**Developed with ❄️ by Snowflake**
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Snowflake Data Exchange Agent
|
|
2
|
+
|
|
3
|
+
[](http://www.apache.org/licenses/LICENSE-2.0.txt)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
|
|
6
|
+
A REST API service for database migrations and data validation. Supports multiple databases including Snowflake, PostgreSQL, and SQL Server with queue-based task processing.
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Install
|
|
12
|
+
pip install snowflake-data-exchange-agent
|
|
13
|
+
|
|
14
|
+
# Run
|
|
15
|
+
data-exchange-agent --port 8080
|
|
16
|
+
|
|
17
|
+
# Test
|
|
18
|
+
curl http://localhost:8080/health
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
### From PyPI (Production)
|
|
24
|
+
```bash
|
|
25
|
+
pip install snowflake-data-exchange-agent
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Requirements & Dependencies
|
|
29
|
+
|
|
30
|
+
**Python Version**: 3.10, 3.11, or 3.12 (3.13 not yet supported)
|
|
31
|
+
|
|
32
|
+
**Available dependency groups**:
|
|
33
|
+
- `development`: Testing and development tools (pytest, ruff, etc.)
|
|
34
|
+
- `all`: Includes all development dependencies
|
|
35
|
+
|
|
36
|
+
**Core dependencies include**:
|
|
37
|
+
- Snowflake Connector for Python
|
|
38
|
+
- PySpark for data processing
|
|
39
|
+
- Flask + Waitress for REST API
|
|
40
|
+
- PostgreSQL support (psycopg2-binary)
|
|
41
|
+
- AWS SDK (boto3)
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
Create `src/data_exchange_agent/configuration.toml`:
|
|
46
|
+
|
|
47
|
+
```toml
|
|
48
|
+
# API settings
|
|
49
|
+
[api_configuration]
|
|
50
|
+
key = "your-api-key"
|
|
51
|
+
host = "0.0.0.0"
|
|
52
|
+
port = 5001
|
|
53
|
+
workers = 4
|
|
54
|
+
|
|
55
|
+
# Database connections
|
|
56
|
+
[connection.postgresql]
|
|
57
|
+
driver_name = "postgresql"
|
|
58
|
+
username = "user"
|
|
59
|
+
password = "password"
|
|
60
|
+
host = "localhost"
|
|
61
|
+
port = 5432
|
|
62
|
+
database = "mydb"
|
|
63
|
+
|
|
64
|
+
# Task queue
|
|
65
|
+
[task_queue]
|
|
66
|
+
type = "sqlite"
|
|
67
|
+
database_path = "~/.data_exchange_agent/tasks.db"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For Snowflake, create `~/.snowflake/config.toml`:
|
|
71
|
+
|
|
72
|
+
```toml
|
|
73
|
+
[connections.default]
|
|
74
|
+
account = "your_account.region"
|
|
75
|
+
user = "your_username"
|
|
76
|
+
password = "your_password"
|
|
77
|
+
warehouse = "COMPUTE_WH"
|
|
78
|
+
database = "PRODUCTION_DB"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## API Usage
|
|
82
|
+
|
|
83
|
+
### Command Line
|
|
84
|
+
```bash
|
|
85
|
+
# Basic usage
|
|
86
|
+
data-exchange-agent
|
|
87
|
+
|
|
88
|
+
# Production settings
|
|
89
|
+
data-exchange-agent --workers 8 --port 8080
|
|
90
|
+
|
|
91
|
+
# Debug mode
|
|
92
|
+
data-exchange-agent --debug --port 5001
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Health Check
|
|
96
|
+
```http
|
|
97
|
+
GET /health
|
|
98
|
+
```
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"status": "healthy",
|
|
102
|
+
"version": "0.0.18",
|
|
103
|
+
"database_connections": {
|
|
104
|
+
"snowflake": "connected"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Task Management
|
|
110
|
+
```http
|
|
111
|
+
# Start processing
|
|
112
|
+
GET /handle_tasks
|
|
113
|
+
|
|
114
|
+
# Stop processing
|
|
115
|
+
GET /stop
|
|
116
|
+
|
|
117
|
+
# Get status
|
|
118
|
+
GET /get_handling_tasks_status
|
|
119
|
+
|
|
120
|
+
# Task count
|
|
121
|
+
GET /get_tasks_count
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Add Task
|
|
125
|
+
```http
|
|
126
|
+
POST /tasks
|
|
127
|
+
Content-Type: application/json
|
|
128
|
+
```
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"task_type": "data_extraction",
|
|
132
|
+
"source_config": {
|
|
133
|
+
"database": "postgresql",
|
|
134
|
+
"query": "SELECT * FROM users"
|
|
135
|
+
},
|
|
136
|
+
"destination_config": {
|
|
137
|
+
"type": "snowflake_stage",
|
|
138
|
+
"stage": "@data_stage/users/"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
### Setup
|
|
146
|
+
```bash
|
|
147
|
+
git clone https://github.com/snowflakedb/migrations-data-validation.git
|
|
148
|
+
cd migrations-data-validation/data-exchange-agent
|
|
149
|
+
pip install -e .[development]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Testing
|
|
153
|
+
```bash
|
|
154
|
+
# Run all tests
|
|
155
|
+
pytest
|
|
156
|
+
|
|
157
|
+
# With coverage
|
|
158
|
+
pytest --cov=src/data_exchange_agent
|
|
159
|
+
|
|
160
|
+
# Run specific test types
|
|
161
|
+
pytest tests/unit/ # Unit tests only
|
|
162
|
+
pytest -m "not integration" # Non-integration tests
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Code Quality
|
|
166
|
+
```bash
|
|
167
|
+
# Format code
|
|
168
|
+
ruff format .
|
|
169
|
+
|
|
170
|
+
# Lint code
|
|
171
|
+
ruff check .
|
|
172
|
+
|
|
173
|
+
# Auto-fix linting issues
|
|
174
|
+
ruff check --fix .
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## 🤝 Contributing
|
|
178
|
+
|
|
179
|
+
We welcome contributions! See our [Contributing Guide](../CONTRIBUTING.md) for details on how to collaborate, set up your development environment, and submit PRs.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 📄 License
|
|
184
|
+
|
|
185
|
+
This project is licensed under the Apache License 2.0. See the [LICENSE](../LICENSE) file for details.
|
|
186
|
+
|
|
187
|
+
## 🆘 Support
|
|
188
|
+
|
|
189
|
+
- **Documentation**: [Full documentation](https://github.com/snowflakedb/migrations-data-validation)
|
|
190
|
+
- **Issues**: [GitHub Issues](https://github.com/snowflakedb/migrations-data-validation/issues)
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
**Developed with ❄️ by Snowflake**
|