Skip to main content

How to apply column filtering on a table?

Column filtering is the ability to specify exactly the columns from the table that should be retrieved in a query. The columns can be specified as a comma separated list with the fields request parameter.

The query below shows how to retrieve only the title,description and release_year columns from the specified film table.

curl --request GET \
--url 'http://localhost:8080/film?fields=title,description,release_year' \
--header 'Accept-Profile: sakila' \
--header 'User-Agent: insomnia/8.4.5'

HTTP/1.1 200
Content-Type: application/json
Transfer-Encoding: chunked

[
{
"title": "ACADEMY DINOSAUR",
"description": "A Epic Drama of a Feminist And a Mad Scientist who must Battle a Teacher in The Canadian Rockies",
"release_year": "2006-01-01"
},
{
"title": "ACE GOLDFINGER",
"description": "A Astounding Epistle of a Database Administrator And a Explorer who must Find a Car in Ancient China",
"release_year": "2006-01-01"
},
## continued...
]

The above query will:

  • fetch all the rows from the table.
  • each row will include only the specified columns from the table.