Exceptions

exception AliasConflict(*, alias: str, ctx: TraverseContext)

Thrown when an alias shadows a table name or another alias name.

Parameters:
  • alias (str) – The alias that conflicts with another name.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception AmbiguousParse(*, trees: list[lark.tree.Tree[ForwardRef('Token')]], ctx: TraverseContext)

Thrown when our grammar parses the unwrapped LLM output, but the query results in multiple parse trees unexpectedly. This is a bug in our grammar, and it should be reported to the author via the link in the exception’s output.

Parameters:
  • trees (list[lark.tree.Tree[ForwardRef('Token')]]) – The list of parse trees that were generated from parsing the query.

  • query – The query that was attempted to be parsed.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

Variables:

issue_link – A link to the GitHub issue that should be opened to report this.

exception BogusJoinedTable(*, table: str, ctx: TraverseContext)

Thrown when a table’s join condition does not include the table itself.

Parameters:
  • table (str) – The table that is not referenced in its own join condition.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception DisconnectedTable(*, table: str, ctx: TraverseContext)

Thrown when a table has joins, but the table in the FROM clause is not connected to any of those joins.

Parameters:
  • table (str) – The table that is not connected to a join.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception IllegalConditionColumn(*, column: FqColumn, ctx: TraverseContext)

Thrown when a column is used in a JOIN condition or a WHERE condition that is not allowed by the constraint validator.

Parameters:
  • column (FqColumn) – The column that was used in the condition.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception IllegalFunction(*, function, ctx: TraverseContext)

Thrown when a disallowed SQL function has been used in the query.

Parameters:
  • function – The lowercase name of the disallowed function.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception IllegalJoinTable(*, join: JoinCondition, ctx: TraverseContext)

Thrown when a join spec is not allowed by the constraint validator.

Parameters:
exception IllegalJoinType(*, join_type: str, ctx: TraverseContext)

Thrown when a non-inner JOIN type is found.

Parameters:
  • join_type (str) – The type of JOIN that was found. This name comes directly from the grammar rule that captured it.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception IllegalSelectedColumn(*, column: str, ctx: TraverseContext)

Thrown when a column is selected that is not allowed by the constraint validator and it was not automatically removed because 🧩 Reconstruction is disabled.

Parameters:
  • column (str) – The column that was selected. This is not a FqColumn because we may not always have a table name.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception InvalidQuery(*, ctx: TraverseContext)

Thrown when our grammar cannot parse the unwrapped LLM output.

Parameters:

ctx (TraverseContext) – The context of the Bifrost traversal.

exception MissingParameterizedConstraint(*, column: FqColumn, placeholder: str, ctx: TraverseContext)

Thrown when a parameterized constraint is missing from the query.

Parameters:
  • column (FqColumn) – The column that is missing the constraint.

  • placeholder (str) – The name of the parameter placeholder for the constraint.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception MissingRequiredIdentity(*, identities: set[heimdallm.bifrosts.sql.common.ParameterizedConstraint], ctx: TraverseContext)

Thrown when a query is missing a required requester identity.

Parameters:
exception ReservedKeyword(*, keyword: str, ctx: TraverseContext)

Thrown when a the query attempts to use a reserved keyword, unescaped, as an alias for a table or column.

Parameters:
  • keyword (str) – The reserved keyword that was used as an alias.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception TooManyRows(*, limit: int | None, ctx: TraverseContext)

Thrown when a query returns too many rows and 🧩 Reconstruction is disabled.

Parameters:
  • limit (int | None) – The number of rows that the query wants to return. Nullable if no limit is specified.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception UnqualifiedColumn(*, column: str, ctx: TraverseContext)

Thrown when a column isn’t fully qualified in the form table.column.

Parameters:
  • column (str) – The column that was not fully qualified.

  • ctx (TraverseContext) – The context of the Bifrost traversal.

exception UnsupportedQuery(*, msg: str, ctx: TraverseContext)

A query may be valid, but not yet supported by our parser.

Parameters:
  • msg (str) – The reason why it is unsupported.

  • ctx (TraverseContext) – The context of the Bifrost traversal.