Skip to content

Conversation

@nicosuave
Copy link
Member

Summary:\n- parse time_comparison/conversion fields from native YAML and export relationship junction metadata\n- add many_to_many join inference via junction tables and include junction keys in CTEs\n- parse DuckDB URL query params, auto-detect Omni/Rill/Superset formats, and include MCP join conditions\n\nTests:\n- uv run pytest tests/db/test_duckdb_adapter.py tests/adapters/sidemantic_adapter/test_parsing.py tests/joins/test_many_to_many_joins.py

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0fbebaccb4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 223 to 227
join_key_base = f"{base_pk}={junction_self_fk}"
add_edge(model_name, junction_model, join_key_base, "one_to_many")
add_edge(junction_model, model_name, join_key_base, "many_to_one")

join_key_related = f"{junction_related_fk}={related_pk}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid ambiguous join keys for many-to-many junctions

In SemanticGraph.build_adjacency, the many-to-many edges are encoded as raw join-key strings like base_pk=junction_fk and junction_fk=related_pk (lines 223-227). find_relationship_path later determines which side owns each key by checking only primary_key, dimensions, or relationship.sql_expr. If the junction model doesn’t declare its FK columns as dimensions/relationships (common for pure bridge tables), model_has_key will not recognize junction_fk, so the join path can flip to the junction’s primary key (e.g., order_items.id = products.product_id), yielding incorrect joins. This makes many-to-many joins silently wrong unless users explicitly model the FK columns. Consider storing explicit join direction in the edge or using the relationship metadata directly when building the JoinPath so junction FKs are used even when not modeled as dimensions.

Useful? React with 👍 / 👎.

@nicosuave nicosuave merged commit 75a989b into main Jan 6, 2026
10 checks passed
@nicosuave nicosuave deleted the many-to-many-support branch January 6, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants