File tree 4 files changed +11
-2
lines changed
main/scala/com.snowplowanalytics.snowplow.snowflake/processing
test/scala/com.snowplowanalytics.snowplow.snowflake/processing
4 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ object Processing {
37
37
def stream [F [_]: Async ](env : Environment [F ]): Stream [F , Nothing ] = {
38
38
val eventProcessingConfig = EventProcessingConfig (EventProcessingConfig .NoWindowing )
39
39
Stream .eval(env.tableManager.initializeEventsTable()) *>
40
+ Stream .eval(env.channel.opened.use_) *>
40
41
env.source.stream(eventProcessingConfig, eventProcessor(env))
41
42
}
42
43
Original file line number Diff line number Diff line change @@ -55,7 +55,10 @@ object SnowflakeRetrying {
55
55
// Authentication failure, i.e. user unrecognized or bad private key
56
56
true .pure[F ]
57
57
case sql : java.sql.SQLException if sql.getErrorCode === 2003 =>
58
- // Object does not exist or not authorized
58
+ // Object does not exist or not authorized to view it
59
+ true .pure[F ]
60
+ case sql : java.sql.SQLException if sql.getErrorCode === 3001 =>
61
+ // Insufficient privileges
59
62
true .pure[F ]
60
63
case _ =>
61
64
false .pure[F ]
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ object TableManager {
59
59
Logger [ConnectionIO ].info(s " Creating table $tableName if it does not already exist... " ) *>
60
60
sqlCreateTable(tableName).update.run.void
61
61
}
62
+ .recoverWith {
63
+ case sql : java.sql.SQLException if sql.getErrorCode === 3001 =>
64
+ Logger [F ].info(s " Access denied when trying to create table. Will ignore error and assume table already exists. " )
65
+ }
62
66
}
63
67
64
68
def executeAddColumnsQuery (columns : List [String ]): F [Unit ] =
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ class ProcessingSpec extends Specification with CatsEffect {
67
67
} yield state should beEqualTo(
68
68
Vector (
69
69
Action .InitEventsTable ,
70
+ Action .OpenedChannel ,
70
71
Action .SentToBad (6 ),
71
72
Action .AddedGoodCountMetric (0 ),
72
73
Action .AddedBadCountMetric (6 ),
@@ -240,9 +241,9 @@ class ProcessingSpec extends Specification with CatsEffect {
240
241
} yield state should beEqualTo(
241
242
Vector (
242
243
Action .InitEventsTable ,
244
+ Action .OpenedChannel ,
243
245
Action .SetLatencyMetric (42123 ),
244
246
Action .SetLatencyMetric (42123 ),
245
- Action .OpenedChannel ,
246
247
Action .WroteRowsToSnowflake (4 ),
247
248
Action .AddedGoodCountMetric (4 ),
248
249
Action .AddedBadCountMetric (0 ),
You can’t perform that action at this time.
0 commit comments