electric-sql/electric

API parameter to filter columns shape

Closed this issue · 1 comments

This issue is concerned with extending the Shapes API with an option for filtering the columns that are stored into shape.

A use shape call should look something like this:

useShape({
  url: `...`,
  table: `foo`,
  columns: [`id`, `title`, `created_at`]
})

and the url should have an argument that is a list of comma-separated columns names that will be included in this shape. It's up to discussion if we want to call the argument select, columns or filter. It's definitely does not have the semantics of SELECT, by the amount of things we can't do with the filter See #1676 -- so we deliberately don't want people to use it as the part of SELECT SQL query.

Some considerations:

  • Naming convention should mimic what we do in WHERE clauses (see #1764)
  • Configure replication filter with the union of filtered columns (see #1774 (comment))