Skip to content

Add widget assets and Malloy extra#59

Merged
nicosuave merged 4 commits intomainfrom
nicosuave/sidemantic-anywidget
Jan 9, 2026
Merged

Add widget assets and Malloy extra#59
nicosuave merged 4 commits intomainfrom
nicosuave/sidemantic-anywidget

Conversation

@nicosuave
Copy link
Copy Markdown
Member

Summary:

  • add anywidget assets and JS build outputs for the notebook widget
  • add malloy optional extra with a clear install hint when antlr4 is missing
  • update README + widget demo notebook and packaging includes

Tests:

  • bun run build
  • uv run --extra dev pytest

Copy link
Copy Markdown

@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: bd17384945

ℹ️ 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 thread sidemantic/widget/_widget.py Outdated
Comment on lines +311 to +315
# Convert to ISO strings
if hasattr(min_date, "isoformat"):
min_date = min_date.isoformat()[:10]
max_date = max_date.isoformat()[:10]
else:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve timestamp precision in date range

Here the computed min/max are truncated to date-only strings (isoformat()[:10]). When the time dimension is a timestamp (common), _build_filters later uses these values in a <= 'YYYY-MM-DD' predicate, which DuckDB treats as midnight. That drops all rows on the end date after 00:00, so the widget undercounts the last day. Keep the full timestamp, or make the end bound exclusive (e.g., < next_day) to avoid silently excluding data.

Useful? React with 👍 / 👎.

Comment on lines +382 to +386
if len(values) == 1:
filter_exprs.append(f"{self._model_name}.{dim_key} = '{values[0]}'")
else:
clauses = " OR ".join(f"{self._model_name}.{dim_key} = '{v}'" for v in values)
filter_exprs.append(f"({clauses})")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Escape dimension values in SQL filters

Dimension filter values are interpolated directly into SQL string literals. If a selected value contains a single quote (e.g., O'Reilly) or other special characters, the generated SQL becomes invalid and the widget errors. Since filter values come from user data, this is a realistic failure case. Use parameterized queries or escape quotes before embedding values.

Useful? React with 👍 / 👎.

@nicosuave nicosuave merged commit 152a643 into main Jan 9, 2026
10 checks passed
@nicosuave nicosuave deleted the nicosuave/sidemantic-anywidget branch January 9, 2026 22:45
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.

1 participant