Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Enable athena routing (#61934)

Riley Thompsonb3a9f566df94
diff --git a/.github/workflows/drivers.yml b/.github/workflows/drivers.yml
index 943dace24f7..d64b5e0443b 100644
--- a/.github/workflows/drivers.yml
+++ b/.github/workflows/drivers.yml
@@ -73,9 +73,11 @@ jobs:
CI: 'true'
DRIVERS: athena
MB_ATHENA_TEST_REGION: us-east-1
+ MB_ATHENA_TEST_REGION_ROUTING: us-east-2
MB_ATHENA_TEST_ACCESS_KEY: ${{ secrets.MB_ATHENA_TEST_ACCESS_KEY }}
MB_ATHENA_TEST_SECRET_KEY: ${{ secrets.MB_ATHENA_TEST_SECRET_KEY }}
MB_ATHENA_TEST_S3_STAGING_DIR: ${{ secrets.MB_ATHENA_TEST_S3_STAGING_DIR }}
+ MB_ATHENA_TEST_S3_STAGING_DIR_ROUTING: ${{ secrets.MB_ATHENA_TEST_S3_STAGING_DIR_ROUTING }}
# These credentials are used to test the driver when the user does not have the athena:GetTableMetadata permission
MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_ACCESS_KEY: ${{ secrets.MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_ACCESS_KEY }}
MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_SECRET_KEY: ${{ secrets.MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_SECRET_KEY }}
diff --git a/enterprise/backend/test/metabase_enterprise/database_routing/e2e_test.clj b/enterprise/backend/test/metabase_enterprise/database_routing/e2e_test.clj
index c723367f042..a545d35e2cd 100644
--- a/enterprise/backend/test/metabase_enterprise/database_routing/e2e_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/database_routing/e2e_test.clj
@@ -213,7 +213,7 @@
(defmethod router-dataset-name :default [_driver] "db-router-data")
-(doseq [driver [:redshift :databricks]]
+(doseq [driver [:redshift :databricks :athena]]
(defmethod router-dataset-name driver [_driver] "db-routing-data"))
(defmulti routed-dataset-name
@@ -224,12 +224,10 @@
(defmethod routed-dataset-name :default [_driver] "db-routed-data")
-(doseq [driver [:redshift :databricks]]
+(doseq [driver [:redshift :databricks :athena]]
(defmethod routed-dataset-name driver [_driver] "db-routing-data"))
(deftest db-routing-e2e-test
- ;; todo: this is to quickly get tests against all drivers right now. We probably want to make a
- ;; few more nice helpers, and remove some of the above tests which are duplicative of the below.
(mt/test-drivers (mt/normal-driver-select {:+features [:database-routing]})
(mt/with-premium-features #{:database-routing}
(binding [tx/*use-routing-dataset* true
diff --git a/modules/drivers/athena/src/metabase/driver/athena.clj b/modules/drivers/athena/src/metabase/driver/athena.clj
index a9e8c95ff12..aefdac838aa 100644
--- a/modules/drivers/athena/src/metabase/driver/athena.clj
+++ b/modules/drivers/athena/src/metabase/driver/athena.clj
@@ -47,7 +47,7 @@
:identifiers-with-spaces false
:metadata/key-constraints false
:test/jvm-timezone-setting false
- :database-routing false}]
+ :database-routing true}]
(defmethod driver/database-supports? [:athena feature] [_driver _feature _db] supported?))
;;; +----------------------------------------------------------------------------------------------------------------+
diff --git a/modules/drivers/athena/test/metabase/test/data/athena.clj b/modules/drivers/athena/test/metabase/test/data/athena.clj
index 410a51b74f1..fc4dd249f9d 100644
--- a/modules/drivers/athena/test/metabase/test/data/athena.clj
+++ b/modules/drivers/athena/test/metabase/test/data/athena.clj
@@ -43,10 +43,14 @@
(defmethod tx/dbdef->connection-details :athena
[driver _context {:keys [database-name], :as _dbdef}]
- {:region (tx/db-test-env-var-or-throw :athena :region)
+ {:region (if tx/*use-routing-details*
+ (tx/db-test-env-var-or-throw :athena :region-routing)
+ (tx/db-test-env-var-or-throw :athena :region))
:access_key (tx/db-test-env-var-or-throw :athena :access-key)
:secret_key (tx/db-test-env-var-or-throw :athena :secret-key)
- :s3_staging_dir (tx/db-test-env-var-or-throw :athena :s3-staging-dir)
+ :s3_staging_dir (if tx/*use-routing-details*
+ (tx/db-test-env-var-or-throw :athena :s3-staging-dir-routing)
+ (tx/db-test-env-var-or-throw :athena :s3-staging-dir))
:catalog "AwsDataCatalog"
:workgroup "primary"
;; HACK -- this is here so the Athena driver sync code only syncs the database in question -- see documentation