Skip to content

ValueError from xorq swallows ibis fallback in _create_connection_from_config #274

Description

@espenjutte

While using boring-semantic-layer with plain ibis/bigquery I encountered a blocking bug when using with a bigquery backend. with a from_yaml. Claude suggested the following fix, but i don't know the wider rammifications on the general codebase, so i'l leave it here as a bug report. Here is a small simple setup with way to reproduce the error:

When using an inline profile: {type: bigquery} in a YAML model definition,
from_yaml crashes with a ValueError from xorq instead of falling back to
ibis.bigquery.connect().

_create_connection_from_config in profile.py already has the right ibis
fallback for backends xorq doesn't support — but the except clause only
catches AssertionError. For BigQuery (and potentially other backends), xorq's
validator raises ValueError, so the fallback is never reached.

The intent is clearly there — the comment even says "Backend not supported by
xorq (e.g. Databricks) — fall back to plain ibis"
— but the wrong exception
type is caught.

To reproduce

# model.yaml
orders:
  profile:
    type: bigquery
  table: orders
  database:
    - bigquery-public-data
    - thelook_ecommerce
  dimensions:
    order_status: _.status
  measures:
    order_count: _.count()
from boring_semantic_layer import from_yaml

models = from_yaml("model.yaml")  # crashes here

Traceback:

File ".../boring_semantic_layer/yaml.py", line 297, in _load_table_for_yaml_model
    connection = get_connection(profile_config)
File ".../boring_semantic_layer/profile.py", line 57, in _connect_from_dict
    return _create_connection_from_config(config)
File ".../boring_semantic_layer/profile.py", line 134, in _create_connection_from_config
    xorq_profile = XorqProfile(con_name=conn_type, kwargs_tuple=kwargs_tuple)
File ".../xorq/vendor/ibis/backends/profiles.py", line 186, in validate_con_name
    raise ValueError(
ValueError: Unknown backend 'bigquery'; installed backends: ['databricks', 'datafusion',
'duckdb', 'gizmosql', 'pandas', 'postgres', 'pyiceberg', 'snowflake', 'sqlite', 'trino',
'xorq_datafusion']

Root cause

profile.py:136 catches AssertionError to trigger the ibis fallback, but
xorq's validate_con_name raises ValueError for unknown backends:

# profile.py — current (broken)
try:
    xorq_profile = XorqProfile(con_name=conn_type, kwargs_tuple=kwargs_tuple)
    connection = xorq_profile.get_con()
except AssertionError:   # <-- ValueError never caught, fallback never runs
    connect_fn = getattr(ibis, conn_type, None)
    ...
    connection = connect_fn.connect(**connect_kwargs)

One-line fix:

except (AssertionError, ValueError):

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions