Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web-console): add materialized views support #405

Merged
merged 26 commits into from
Mar 20, 2025

Conversation

emrberk
Copy link
Contributor

@emrberk emrberk commented Mar 13, 2025

Screenshot 2025-03-20 at 18 04 37

  • Optimizes table listing using GroupedVirtuoso from react-virtuoso. Reduces render time in case we have 1000s of tables / mat. views.
  • Adds SQL grammar support for materialized views.
  • Materialized views shows the base table, and copying schema invokes show create materialized view... instead of show create table.
  • Resume WAL button, in case of suspension, is moved to right-click context menu.
  • Copy Schema action is available in the context menu.
  • Fixes hide/show tables wording. We were showing "hide" even when it was hidden. Changes "tables" wording to "data sources" (highly subject to a discussion).
  • Adds icons for different column types.
  • Moves column type text to the left, changes the color.
  • Replaces react-contextmenu with @radix-ui/react-context-menu due to bugs.
  • Adds e2e tests for UI changes.

@emrberk emrberk force-pushed the feat/materialized-views branch from bd0e64c to b50f1c4 Compare March 13, 2025 12:03
@emrberk emrberk force-pushed the feat/materialized-views branch from 835c46a to 7136d48 Compare March 13, 2025 18:26
@emrberk emrberk marked this pull request as ready for review March 13, 2025 18:54
@emrberk emrberk requested review from goodroot and glasstiger March 13, 2025 18:54
Copy link
Contributor

@goodroot goodroot left a comment

Choose a reason for hiding this comment

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

Congrats on first PR 😀 - I appreciate the approach & fearlessness.

A couple broad questions, a some comments, and a few visual/functional things.

🫡 Solid push.


It is not clear how to "use" the materialized view.

We can see them and copy the query. But there isn't any interactivity beyond that.

What is the goal of the current view?

Can we "help" more?

  • Link out to docs somewhere if there's no view? ie. better zero-state?

  • Instead of a copy, perhaps create a tab & launch the query on click?

  • If "materialized view" tab is active, execute query when appropriate?

Maybe beyond the scope of our first increment, and we might not have answers yet.

That's cool. 😃 But let's figure out where we're going.


"Invalid" states are missing.

There are conditions which can invalidate a mat view:

  • Schema changes to the base table
  • With deduplication, views must use same grouping keys as the base table's UPSERT KEYS
  • More

During these states, the view needs a REFRESH. Do we guide through these cases?

More fatally, if the base table is dropped, there's no feedback.

For this, base table row is a potential space for warning and repair guidance:

Screenshot 2025-03-13 at 2 47 20 PM

The Table & Materialized view sections match base BG colour.

Screenshot 2025-03-13 at 2 39 57 PM

It seems off to me. Can we delineate them in a stylish way?

Maybe so tables & mat view look as "children" within data sources section?


Symmetry of the toggleable data sources button broke with filter change:

Screenshot 2025-03-13 at 2 45 52 PM

Before, it balanced with table view contents:

Screenshot 2025-03-13 at 2 50 29 PM

emrberk and others added 7 commits March 14, 2025 11:16
@emrberk emrberk force-pushed the feat/materialized-views branch from 9cc94d1 to 6d17ca8 Compare March 15, 2025 20:28
@emrberk
Copy link
Contributor Author

emrberk commented Mar 15, 2025

Can we delineate them in a stylish way?
Maybe so tables & mat view look as "children" within data sources section?

@goodroot please take a look at this one:
Screenshot 2025-03-15 at 23 45 50
The hierarchy seems more visible this time.

@emrberk emrberk force-pushed the feat/materialized-views branch from 946d87f to 18e8001 Compare March 15, 2025 22:33
@emrberk
Copy link
Contributor Author

emrberk commented Mar 18, 2025

Hey @goodroot, I updated the PR with the design we agreed on the discussion.

@emrberk emrberk requested a review from bluestreak01 March 19, 2025 14:47
goodroot
goodroot previously approved these changes Mar 19, 2025
@goodroot goodroot dismissed their stale review March 19, 2025 22:00

still wip

@goodroot goodroot self-requested a review March 19, 2025 22:00
Copy link
Contributor

@goodroot goodroot left a comment

Choose a reason for hiding this comment

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

Solid work - the tree view feels fast and the ux is clean.

In another iteration, it'd be worthwhile to make the mat view section useful.

Right now, it's informational.

But "open query in tab" or something would go a long way.

I will have to step away for some time.

So, LGTM from here. 👍

@bluestreak01 bluestreak01 merged commit 61e7d25 into main Mar 20, 2025
4 checks passed
@bluestreak01 bluestreak01 deleted the feat/materialized-views branch March 20, 2025 15:12
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.

3 participants