-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for multiple DB tenants in SQL mode (#3444)
- Loading branch information
Showing
26 changed files
with
310 additions
and
198 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
23 changes: 23 additions & 0 deletions
23
backend/src/main/java/com/bakdata/conquery/models/config/DatabaseConfig.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,23 @@ | ||
package com.bakdata.conquery.models.config; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class DatabaseConfig { | ||
|
||
private static final String DEFAULT_PRIMARY_COLUMN = "pid"; | ||
|
||
private Dialect dialect; | ||
|
||
private String databaseUsername; | ||
|
||
private String databasePassword; | ||
|
||
private String jdbcConnectionUrl; | ||
|
||
@Builder.Default | ||
private String primaryColumn = DEFAULT_PRIMARY_COLUMN; | ||
|
||
} |
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
29 changes: 29 additions & 0 deletions
29
backend/src/main/java/com/bakdata/conquery/sql/DSLContextWrapper.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,29 @@ | ||
package com.bakdata.conquery.sql; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
|
||
import com.zaxxer.hikari.HikariDataSource; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.jooq.DSLContext; | ||
|
||
/** | ||
* Provides access to a configured {@link DSLContext} and enables closing the underlying connection pool. | ||
*/ | ||
@RequiredArgsConstructor | ||
public class DSLContextWrapper implements Closeable { | ||
|
||
@Getter | ||
private final DSLContext dslContext; | ||
|
||
private final HikariDataSource dataSource; | ||
|
||
@Override | ||
public void close() throws IOException { | ||
// Hikari opens a connection pool under the hood which we won't be able to close after passing it to the DSLContext. | ||
// That's why we keep the HikariDataSource reference. | ||
dataSource.close(); | ||
} | ||
|
||
} |
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
11 changes: 0 additions & 11 deletions
11
backend/src/main/java/com/bakdata/conquery/sql/SqlContext.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.