Skip to content

How to filter rows for linked tables #1607

@dexion

Description

@dexion

Hi! Your project is really interesting!

I have a question. Let's take a schema like this:

project has uniq id:UUID
task -> belongs to project by project_id
issue -> belongs to task by task_id
comment -> belongs to issue by issue_id

Table projects_users for m2m link:

project_id: uuid
user_id: uuid

Now user has a lot of accessible comments through: project -> tasks -> issues
In a regular SQL we can retrieve comments from DB like this:

select * from comments
	JOIN projects_users
	JOIN project on ...
	JOIN task ...
	JOIN issues ...
	JOIN comment on ....
where project_users.user_id == current_user.id

How can we limit electric's shapes of comments to be only accessible to user from auth-token when we call /v1/shape/comments?offset=-1? In this example, we shouldn't get all diffs, only diffs for comments linked to one project.

I would like to see an advanced example of usage in your docs. Maybe you can extend your example with projects-issues-comments?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions