diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/table/TableRowUpdater.java b/Model/src/main/java/org/gusdb/wdk/model/fix/table/TableRowUpdater.java index aee4046a3..eeda0e470 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/table/TableRowUpdater.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/table/TableRowUpdater.java @@ -230,6 +230,10 @@ private ExitStatus run() { Set tables = _writers.stream() .map(writer -> writer.getTableNamesForBackup(userSchema)) .flatMap(Collection::stream) + .peek(name -> { + if (name == null) + throw new RuntimeException(getClass().getName() + " returned a null table name for backup."); + }) .collect(Collectors.toSet()); // create backup tables backUpTables(userDb.getDataSource(), tables); diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/table/edaanalysis/AbstractAnalysisUpdater.java b/Model/src/main/java/org/gusdb/wdk/model/fix/table/edaanalysis/AbstractAnalysisUpdater.java index 328c7a7a0..0301da198 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/table/edaanalysis/AbstractAnalysisUpdater.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/table/edaanalysis/AbstractAnalysisUpdater.java @@ -23,7 +23,7 @@ public void configure(WdkModel wdkModel, List additionalArgs) throws Exc @Override public TableRowUpdater getTableRowUpdater(WdkModel wdkModel) { - AnalysisRecordFactory factory = new AnalysisRecordFactory(); + AnalysisRecordFactory factory = new AnalysisRecordFactory(wdkModel.getProjectId()); return new TableRowUpdater(factory, factory, this, wdkModel); } diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/table/edaanalysis/AnalysisRecordFactory.java b/Model/src/main/java/org/gusdb/wdk/model/fix/table/edaanalysis/AnalysisRecordFactory.java index 61b1dbc13..12cf39c8a 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/table/edaanalysis/AnalysisRecordFactory.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/table/edaanalysis/AnalysisRecordFactory.java @@ -20,14 +20,17 @@ public class AnalysisRecordFactory implements TableRowFactory, Tabl private String _schema; - @Override - public String getRecordsSql(String schema, String projectId) { - // reset schema based on project (userdb schema is not where eda data lives + public AnalysisRecordFactory(String projectId) { + // set schema based on project (userdb schema is not where eda data lives switch(projectId) { case "ClinEpiDB": _schema = "edauserce"; break; case "MicrobiomeDB": _schema = "edausermb"; break; default: _schema = "edauservb"; break; } + } + + @Override + public String getRecordsSql(String schema, String projectId) { return "select analysis_id, study_id, analysis_descriptor, num_filters, num_computations, num_visualizations" + " from " + _schema + ".analysis";