Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to skip connection check for certain sources #2374

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/org/ohdsi/webapi/source/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public class Source extends CommonEntity<Integer> implements Serializable {
@Column(name = "is_cache_enabled")
private boolean isCacheEnabled;

@Column(name = "check_connection")
private boolean checkConnection;


public String getTableQualifier(DaimonType daimonType) {
String result = getTableQualifierOrNull(daimonType);
if (result == null)
Expand Down Expand Up @@ -251,6 +255,14 @@ public void setIsCacheEnabled(boolean isCacheEnabled) {
this.isCacheEnabled = isCacheEnabled;
}

public boolean isCheckConnection() {
return checkConnection;
}

public void setCheckConnection(boolean checkConnection) {
this.checkConnection = checkConnection;
}

@Override
public boolean equals(Object o) {

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/ohdsi/webapi/source/SourceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ public <T> Map<T, Source> getSourcesMap(SourceMapKey<T> mapKey) {

public void checkConnection(Source source) {

final JdbcTemplate jdbcTemplate = getSourceJdbcTemplate(source);
jdbcTemplate.execute(SqlTranslate.translateSql("select 1;", source.getSourceDialect()).replaceAll(";$", ""));
if (source.isCheckConnection()) {
final JdbcTemplate jdbcTemplate = getSourceJdbcTemplate(source);
jdbcTemplate.execute(SqlTranslate.translateSql("select 1;", source.getSourceDialect()).replaceAll(";$", ""));
}
}

public Source getPrioritySourceForDaimon(SourceDaimon.DaimonType daimonType) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE ${ohdsiSchema}.source
ADD COLUMN check_connection boolean not null DEFAULT true;
Loading