Skip to content

SQL Scope

The SQL editor can now consume the current Analyze context instead of forcing you to rebuild it manually.

That means you can:

  • brush dies in Analyze
  • stage what-if limits
  • switch to SQL
  • query the same scoped population directly

This is a one-way flow in alpha:

  • Analyze -> SQL

SQL does not push selection or limits back into Analyze yet.

Large result sets now page inside the SQL editor. You can still use raw SQL LIMIT / OFFSET when you want exact query-shaped paging yourself.

When Analyze has an active lot, the SQL editor receives:

  • lot id
  • current notebook snapshot id
  • current die selection
  • active what-if limit overrides
  • current test and wafer context

That scope is exposed through helper tables and views.

One-row summary of the propagated context.

Use it to confirm what the SQL editor thinks the current scope is.

Notebook what-if limits for the current scope.

Columns:

  • test_number
  • test_name
  • lsl
  • usl

The exact brushed die identities from Analyze.

Columns:

  • wafer_number
  • x
  • y

The die view filtered to the current selection.

If no selection is active, it resolves to the whole current lot.

If Analyze is pinned to a historical snapshot, this helper follows that pinned snapshot.

The test_results view filtered to the current selection and enriched with the active notebook what-if limits.

Important columns:

  • has_scope_override
  • scope_limit_source
  • scope_low_limit
  • scope_high_limit
  • raw_pass
  • scope_pass

has_scope_override and scope_limit_source tell you whether a row is using baseline limits or a notebook what-if override.

scope_pass uses the current notebook what-if limits when they exist, so it is the SQL-side way to work from the same review context as Analyze.

If Analyze is pinned to a historical snapshot, this helper follows that pinned snapshot too.

The current scoped results filtered to the active Analyze test when one exists.

Use this when you want SQL to stay anchored to the same test you were just inspecting in scatter or histogram.

SELECT * FROM current_scope;
SELECT * FROM current_scope_limits ORDER BY test_number;
SELECT * FROM current_scope_active_test_results LIMIT 200;
SELECT
test_number,
test_name,
COUNT(*) AS n,
AVG(result) AS mean_result,
SUM(CASE WHEN scope_pass THEN 1 ELSE 0 END) AS pass_count,
SUM(CASE WHEN NOT scope_pass THEN 1 ELSE 0 END) AS fail_count
FROM current_scope_test_results
GROUP BY test_number, test_name
ORDER BY fail_count DESC, test_number
LIMIT 20;