When using multiple SQL cells in marimo with DuckDB, creating tables with the same name in different schemas leads to a variable redefinition error.
Although the tables are fully qualified and valid in DuckDB, marimo raises an error due to internal variable name collisions.
Minimal Reproducible Example
sql
-- Cell 1
CREATE TABLE finance.datalake.xx (id INT);
sql
-- Cell 2
CREATE TABLE finance.information_layer.xx (id INT);
ERROR
text
This cell wasn't run because it has errors
This cell redefines variables from other cells.
'xx' was also defined by:
dl
Fix: Wrap in a function
Why can't I redefine variables?
Expected Behavior
Since the tables are created in different schemas, both statements should execute without conflict:
That is my opinion. What is the marimo way, to handle this?
Best
Eric
Evaluation contract
Track SQL definitions by their complete qualified identity. Tables with the same leaf name in different schemas or catalogs are not multiply defined; the same fully qualified name, or the same unqualified name, still is. Preserve the user-facing table variable, defining-cell ownership, deletion behavior, and conflict reporting for genuine collisions.
Interface
Type: Function
Name: get_multiply_defined
Path: marimo/_runtime/dataflow/definitions.py
Input: self
Output: list[tuple[Name, set[CellId_t]]]
Description: Returns a list of (name, cell_ids) tuples for names that are defined in multiple cells. Uses conflict-aware grouping so that qualified SQL names (e.g., schema.table) with the same leaf name are not considered multiply defined unless they share the exact same qualified name.