This application is used to migrate Storage data from one project to another. It is designed to be used in the Keboola Connection environment.
The application migrates tables data from one project to another. If a bucket does not exist, it will be created. Similarly, if a table does not exist, it will be created.
In SAPI mode, the application migrates data using the Storage API of Keboola Connection.
In Database mode, the application migrates data directly between databases. This mode is significantly faster. Please note the following conditions:
- Replication from the source database must be allowed.
- Both Snowflake accounts must be in the same organization.
- The Snowflake user must have the
ACCOUNTADMIN
role.
To enable replication, the source Snowflake account must first allow replication and then execute the following SQL:
ALTER DATABASE {{SOURCE_DATABASE_NAME}} ENABLE REPLICATION TO ACCOUNTS {{DESTINATION_ACCOUNT_REGION}}.{{DESTINATION_ACCOUNT_NAME}};
If these conditions are not fulfilled, please use SAPI mode.
The configuration config.json
contains following properties:
parameters
- object (required): Configuration of the applicationmode
- string (optional):sapi
(default value) ordatabase
dryRun
- boolean (optional): If set totrue
, the application will only simulate the migration.sourceKbcUrl
- string (required): URL of the source projectsourceKbcToken
- string (required): Storage API token of the source projecttables
- array (optional): List of tables to migrate. If not set, all tables will be migrated.db
- object (optional indatabase
mode and extendsdb
object inimage_parameters
):host
- string (required): Snowflake hostusername
- string (required): Snowflake username#password
- string (required): Snowflake passwordwarehouse
- string (required): Snowflake warehouse
image_parameters
- object (require): Includes from Developer Portaldb
- object (required indatabase
mode):host
- string (required): Snowflake hostusername
- string (required): Snowflake username#password
- string (required): Snowflake passwordwarehouse
- string (required): Snowflake warehouse
{
"parameters": {
"mode": "sapi",
"dryRun": true,
"sourceKbcUrl": "https://connection.keboola.com/",
"#sourceKbcToken": "SOURCE_KBC_TOKEN"
}
}
{
"parameters": {
"mode": "sapi",
"sourceKbcUrl": "https://connection.keboola.com/",
"#sourceKbcToken": "SOURCE_KBC_TOKEN"
}
}
{
"parameters": {
"mode": "database",
"sourceKbcUrl": "https://connection.keboola.com/",
"#sourceKbcToken": "SOURCE_KBC_TOKEN"
}
}
{
"parameters": {
"mode": "database",
"sourceKbcUrl": "https://connection.keboola.com/",
"#sourceKbcToken": "SOURCE_KBC_TOKEN",
"db": {
"host": "SNOWFLAKE_HOST",
"username": "SNOWFLAKE_USERNAME",
"#password": "SNOWFLAKE_PASSWORD",
"warehouse": "SNOWFLAKE_WAREHOUSE"
}
}
}
Clone this repository and init the workspace with following command:
git clone https://github.com/keboola/app-project-migrate-tables-data
cd app-project-migrate-tables-data
docker-compose build
docker-compose run --rm dev composer install --no-scripts
Save .env file with following content:
SOURCE_CLIENT_URL=
SOURCE_CLIENT_TOKEN=
DESTINATION_CLIENT_URL=
DESTINATION_CLIENT_TOKEN=
Run the test suite using this command:
docker-compose run --rm dev composer tests