apache/superset · error · ValueError

created_by_fk_or_editor only supports 'eq'; got '{c.opr}'

Error message

created_by_fk_or_editor only supports 'eq'; got '{c.opr}'

What it means

ValueError raised in DatasetDAO's filter extension (superset/daos/dataset.py): the synthetic filter column 'created_by_fk_or_editor' (datasets created by a user OR edited by that user's subject via sqlatable_editors) only implements equality; any operator other than 'eq' is rejected.

Source

Thrown at superset/daos/dataset.py:107

                operator_enum = ColumnOperatorEnum(c.opr)
                subq = (
                    select(sqlatable_editors.c.table_id)
                    .join(
                        Subject.__table__,
                        Subject.__table__.c.id == sqlatable_editors.c.subject_id,
                    )
                    .where(
                        Subject.__table__.c.type == 1,
                        operator_enum.apply(Subject.__table__.c.user_id, c.value),
                    )
                )
                query = query.filter(
                    SqlaTable.id.in_(subq)  # type: ignore[attr-defined,unused-ignore]
                )
            elif c.col == "created_by_fk_or_editor":
                if c.opr != "eq":
                    raise ValueError(
                        f"created_by_fk_or_editor only supports 'eq'; got '{c.opr}'"
                    )
                from superset.subjects.models import sqlatable_editors, Subject

                editor_subq = (
                    select(sqlatable_editors.c.table_id)
                    .join(
                        Subject.__table__,
                        Subject.__table__.c.id == sqlatable_editors.c.subject_id,
                    )
                    .where(
                        Subject.__table__.c.type == 1,
                        Subject.__table__.c.user_id == c.value,
                    )
                )
                query = query.filter(
                    or_(
                        SqlaTable.created_by_fk == c.value,  # type: ignore[attr-defined,unused-ignore]

View on GitHub (pinned to f4587218dd)

Solutions

  1. Use "opr": "eq" with a scalar user id.
  2. Use created_by_fk (a real column) if you need other operators like in/nin on the creator alone.
  3. Consult the dataset resource's advertised filter columns/operators before constructing the payload.

Example fix

# before
filters=[{"col": "created_by_fk_or_editor", "opr": "in", "value": [1, 2]}]

# after
filters=[{"col": "created_by_fk", "opr": "in", "value": [1, 2]}]
Defensive patterns

Strategy: validation

Validate before calling

def dataset_filters_valid(filters) -> bool:
    return all(
        not (f.get("col") == "created_by_fk_or_editor" and f.get("opr") != "eq")
        for f in filters or []
    )

Type guard

def is_eq_filter(f: dict) -> bool:
    return f.get("opr") == "eq"

Try / catch

try:
    DatasetDAO.find(query=", filters=filters)
except ValueError as ex:
    if "created_by_fk_or_editor" in str(ex):
        filters = [{**f, "opr": "eq"} for f in filters if f["col"] == "created_by_fk_or_editor"]
        results = DatasetDAO.find(query=", filters=filters)

Prevention

When it happens

Trigger: Calling /api/v1/dataset/ or DatasetDAO.find with filters=[{"col": "created_by_fk_or_editor", "opr": "<anything-but-eq>", ...}].

Common situations: The same shared filter builder reused across chart/dashboard/dataset endpoints assuming a uniform operator set; MCP tool clients enumerating filter columns.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/6514fec7fddc30c0. Report an issue: GitHub.