-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataSource refactoring + Snowflake fixes (#4204)
* more cleanup Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * rollback Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * set connection test query Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * remove explicit token property loading Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * add DatabaseType to dirigible data sources Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * rename DatabaseType to DatabaseSystem since it is already used move to common package the type Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * dont add props twice Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * do not overwrite snowflake properties Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * remove user Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * rollback Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * refactor SqlDialectFactory use DirigibleDataSource for optimization Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * refactoring Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * add some optimizations Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * add wrapper for db connections + optimize dialect loading Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * fix Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * fix build Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * schedule snowflake datasource destroy after 9 mins since created Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * refactoring Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * code formatting Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * refact Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * cleanup Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * refactor connection enhance logic Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * remove logger Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * more cleanup Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * DatabaseSystemDeterminer refactoring Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * set dirigible loggers to debug in integration tests Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * code formating Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * add TS API Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * refactoring Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * fix Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * reduce logging Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * fix postgresql IT stability - provision tenant and then publish the test project Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * increase timeout Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> * add DIRIGIBLE_SNOWFLAKE_DATA_SOURCE_LIFESPAN_SECONDS config Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com> --------- Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com>
- Loading branch information
1 parent
49709f3
commit 2a536a3
Showing
55 changed files
with
1,471 additions
and
691 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...-database/src/main/java/org/eclipse/dirigible/components/database/ConnectionEnhancer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) 2024 Eclipse Dirigible contributors | ||
* | ||
* All rights reserved. This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-FileCopyrightText: Eclipse Dirigible contributors SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.dirigible.components.database; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
public interface ConnectionEnhancer { | ||
|
||
boolean isApplicable(DatabaseSystem databaseSystem); | ||
|
||
void apply(Connection connection) throws SQLException; | ||
} |
22 changes: 22 additions & 0 deletions
22
...atabase/src/main/java/org/eclipse/dirigible/components/database/DatabaseConfigurator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2024 Eclipse Dirigible contributors | ||
* | ||
* All rights reserved. This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-FileCopyrightText: Eclipse Dirigible contributors SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.dirigible.components.database; | ||
|
||
import com.zaxxer.hikari.HikariConfig; | ||
|
||
/** | ||
* The Interface DatabaseConfigurator. | ||
*/ | ||
public interface DatabaseConfigurator { | ||
|
||
boolean isApplicable(DatabaseSystem databaseSystem); | ||
|
||
void apply(HikariConfig config); | ||
} |
48 changes: 48 additions & 0 deletions
48
...core-database/src/main/java/org/eclipse/dirigible/components/database/DatabaseSystem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.eclipse.dirigible.components.database; | ||
|
||
public enum DatabaseSystem { | ||
// when adding or changing enum values do NOT forget to | ||
// update the JavaScript API in the connection class located at: | ||
// dirigible/modules/src/db/database.ts | ||
UNKNOWN, DERBY, POSTGRESQL, H2, MARIADB, HANA, SNOWFLAKE, MYSQL, MONGODB, SYBASE; | ||
|
||
public boolean isH2() { | ||
return isOfType(H2); | ||
} | ||
|
||
public boolean isSnowflake() { | ||
return isOfType(SNOWFLAKE); | ||
} | ||
|
||
public boolean isHANA() { | ||
return isOfType(HANA); | ||
} | ||
|
||
public boolean isPostgreSQL() { | ||
return isOfType(POSTGRESQL); | ||
} | ||
|
||
public boolean isMariaDB() { | ||
return isOfType(MARIADB); | ||
} | ||
|
||
public boolean isMySQL() { | ||
return isOfType(MYSQL); | ||
} | ||
|
||
public boolean isUnknown() { | ||
return isOfType(UNKNOWN); | ||
} | ||
|
||
public boolean isMongoDB() { | ||
return isOfType(MONGODB); | ||
} | ||
|
||
public boolean isDerby() { | ||
return isOfType(DERBY); | ||
} | ||
|
||
public boolean isOfType(DatabaseSystem databaseSystem) { | ||
return this == databaseSystem; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...database/src/main/java/org/eclipse/dirigible/components/database/DatabaseSystemAware.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.eclipse.dirigible.components.database; | ||
|
||
public interface DatabaseSystemAware { | ||
|
||
DatabaseSystem getDatabaseSystem(); | ||
|
||
boolean isOfType(DatabaseSystem databaseSystem); | ||
|
||
} |
Oops, something went wrong.