From 86040f9ea455adbd606cb1c9aaac102c141c8728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Poniedzia=C5=82ek?= Date: Thu, 3 Aug 2023 15:04:25 +0200 Subject: [PATCH] Add snowflake test schema environment variable --- .../e2e/SnowflakeE2E.scala | 1 + .../e2e/storage/SnowflakeSupport.scala | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/e2e/SnowflakeE2E.scala b/core/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/e2e/SnowflakeE2E.scala index e5ed09bee..02dcd4c37 100644 --- a/core/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/e2e/SnowflakeE2E.scala +++ b/core/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/e2e/SnowflakeE2E.scala @@ -8,6 +8,7 @@ import com.snowplowanalytics.snowplow.collectors.scalastream.e2e.storage.Snowfla * - TEST_SNOWFLAKE_URL (format like: 'jdbc:snowflake://${accountName}.snowflakecomputing.com') * - TEST_SNOWFLAKE_WAREHOUSE * - TEST_SNOWFLAKE_DATABASE + * - TEST_SNOWFLAKE_SCHEMA * - TEST_SNOWFLAKE_USERNAME * - TEST_SNOWFLAKE_PASSWORD */ diff --git a/core/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/e2e/storage/SnowflakeSupport.scala b/core/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/e2e/storage/SnowflakeSupport.scala index 96ff02c1b..487c38727 100644 --- a/core/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/e2e/storage/SnowflakeSupport.scala +++ b/core/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/e2e/storage/SnowflakeSupport.scala @@ -2,7 +2,7 @@ package com.snowplowanalytics.snowplow.collectors.scalastream.e2e.storage import cats.effect.{ContextShift, IO} import SnowflakeSupport._ -import doobie.Transactor +import doobie.{Fragment, Transactor} import doobie.implicits._ import doobie.util.fragment @@ -27,13 +27,16 @@ trait SnowflakeSupport extends StorageTarget { ) } - override def countEventsWithAppIdQuery(appId: String): fragment.Fragment = - sql"""select count(*) from atomic.events where app_id = $appId""" + override def countEventsWithAppIdQuery(appId: String): fragment.Fragment = { + val schema = System.getenv(snowflakeSchemaEnv) + sql"select count(*) from ${Fragment.const0(s"$schema.events")} where app_id = $appId" + } override def storageEnvironmentVariables: List[String] = List( snowflakeUrlEnv, snowflakeWarehouseEnv, snowflakeDatabaseEnv, + snowflakeSchemaEnv, snowflakeUsernameEnv, snowflakePasswordEnv ) @@ -44,6 +47,7 @@ object SnowflakeSupport { val snowflakeUrlEnv = "TEST_SNOWFLAKE_URL" val snowflakeWarehouseEnv = "TEST_SNOWFLAKE_WAREHOUSE" val snowflakeDatabaseEnv = "TEST_SNOWFLAKE_DATABASE" + val snowflakeSchemaEnv = "TEST_SNOWFLAKE_SCHEMA" val snowflakeUsernameEnv = "TEST_SNOWFLAKE_USERNAME" val snowflakePasswordEnv = "TEST_SNOWFLAKE_PASSWORD" }