diff --git a/src/DbBackend/SnowflakeBackend.php b/src/DbBackend/SnowflakeBackend.php index 41b3ec8..bfc493c 100644 --- a/src/DbBackend/SnowflakeBackend.php +++ b/src/DbBackend/SnowflakeBackend.php @@ -10,7 +10,9 @@ class SnowflakeBackend implements DbBackend { - public const COMPONENT_KEBOOLA_WR_DB_SNOWFLAKE = 'keboola.wr-db-snowflake'; + public const COMPONENT_KEBOOLA_WR_DB_SNOWFLAKE_S3 = 'keboola.wr-db-snowflake'; + + public const COMPONENT_KEBOOLA_WR_DB_SNOWFLAKE_ABS = 'keboola.wr-snowflake-blob-storage'; private Config $config; @@ -56,7 +58,14 @@ public function createDbConnectionApiObject(string $connectionName): DBConnectio public function getWriterComponentName(): string { - return self::COMPONENT_KEBOOLA_WR_DB_SNOWFLAKE; + switch ($this->config->getStorageApiUrl()) { + case 'connection.north-europe.azure.keboola.com': + case 'connection.csas.keboola.cloud': + case 'connection.csas-test.keboola.com': + return self::COMPONENT_KEBOOLA_WR_DB_SNOWFLAKE_ABS; + default: + return self::COMPONENT_KEBOOLA_WR_DB_SNOWFLAKE_S3; + } } public function getTestConnectionConfig(): ?array diff --git a/tests/phpunit/DbBeckend/SnowflakeBackendTest.php b/tests/phpunit/DbBeckend/SnowflakeBackendTest.php new file mode 100644 index 0000000..e852e7f --- /dev/null +++ b/tests/phpunit/DbBeckend/SnowflakeBackendTest.php @@ -0,0 +1,54 @@ +getWriterComponentName()); + } + + public function componentNameDataProvider(): Generator + { + yield 'azure-ne' => [ + 'connection.north-europe.azure.keboola.com', + 'keboola.wr-snowflake-blob-storage', + ]; + + yield 'azure-csas-prod' => [ + 'connection.csas.keboola.cloud', + 'keboola.wr-snowflake-blob-storage', + ]; + + yield 'azure-csas-test' => [ + 'connection.csas-test.keboola.com', + 'keboola.wr-snowflake-blob-storage', + ]; + + yield 'aws-us' => [ + 'connection.keboola.com', + 'keboola.wr-db-snowflake', + ]; + + yield 'aws-eu' => [ + 'connection.eu-central-1.keboola.com', + 'keboola.wr-db-snowflake', + ]; + } +}