Skip to content
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
7 changes: 4 additions & 3 deletions src/org/labkey/targetedms/query/TargetedMSForeignKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public TargetedMSForeignKey(TargetedMSSchema schema, String tableName, Container
@Override
public TableInfo getLookupTableInfo()
{
TableInfo table = _schema.getTable(_tableName);
((TargetedMSTable)table).setNeedsContainerWhereClause(false);
return table;
// Avoid applying a container filter on lookups. The import process should be only creating FKs to data
// in the same container. Thus, we can rely on the outer query doing the proper filtering and avoid
// what can be expensive multi-table joins to get to a table that has the Container column we need
return _schema.getTable(_tableName, ContainerFilter.EVERYTHING);
}
}
7 changes: 1 addition & 6 deletions src/org/labkey/targetedms/query/TargetedMSTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ protected void applyContainerFilter(ContainerFilter filter)
// Don't apply the container filter normally, let us apply it in our wrapper around the normally generated SQL
}

public void setNeedsContainerWhereClause(boolean needsContainerWhereClause)
{
_needsContainerWhereClause = needsContainerWhereClause;
}

@Override
@NotNull
public SQLFragment getFromSQL(String alias)
Expand All @@ -102,7 +97,7 @@ public SQLFragment getFromSQL(String alias)
sql.append(super.getFromSQL("X"));
sql.append(" ");

if (_needsContainerWhereClause || _containerTableFilter != null)
if (getContainerFilter() != ContainerFilter.EVERYTHING || _containerTableFilter != null)
{
sql.append(_joinType != null ? _joinType.getSQL() : "");

Expand Down