Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1b825cb

Browse files
authoredJan 4, 2024
Merge pull request #28 from cloudsufi/cherrypick-oauth-3.14.4
[Cherrypick][PLUGIN-1731][PLUGIN-1734] Fix Oauth issue and driver upgrade to 3.14.4
2 parents 553189b + 2dc31af commit 1b825cb

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed
 

‎pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<powermock.version>1.7.4</powermock.version>
4848
<guice.version>4.0</guice.version>
4949
<opencsv.version>2.4</opencsv.version>
50-
<snowflake-jdbc.version>3.13.24</snowflake-jdbc.version>
50+
<snowflake-jdbc.version>3.14.4</snowflake-jdbc.version>
5151
</properties>
5252

5353
<repositories>

‎src/main/java/io/cdap/plugin/snowflake/common/client/SnowflakeAccessor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ private void initDataSource(SnowflakeBasicDataSource dataSource, BaseSnowflakeCo
111111
if (config.getOauth2Enabled()) {
112112
String accessToken = OAuthUtil.getAccessTokenByRefreshToken(HttpClients.createDefault(), config);
113113
dataSource.setOauthToken(accessToken);
114+
// The recommend way to pass token is in the password when you use the driver with connection pool.
115+
// This is also a mandatory field, so adding the same.
116+
// Refer https://github.com/snowflakedb/snowflake-jdbc/issues/1175
117+
dataSource.setPassword(accessToken);
114118
} else if (config.getKeyPairEnabled()) {
115119
dataSource.setUser(config.getUsername());
116120

‎src/main/java/io/cdap/plugin/snowflake/sink/batch/SnowflakeSinkConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public void validate(Schema inputSchema, FailureCollector failureCollector) {
9898
* @param schema input schema to check
9999
*/
100100
private void validateInputSchema(Schema schema, FailureCollector failureCollector) {
101-
// schema can be null in case it is a macro
102-
if (schema == null) {
101+
// return if schema is null or if any of the connection properties or table name is macro
102+
if (schema == null || !canConnect() || containsMacro(PROPERTY_TABLE_NAME)) {
103103
return;
104104
}
105105

0 commit comments

Comments
 (0)
Please sign in to comment.