1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to NoSQL

Connected

Exercise

Filtering document databases with Postgres JSON

Using Postgres JSON, data stored in documents can be queried and filtered using the -> and ->> operators. To practice, you'll filter reviews using Postgres JSON. Similar to before, the nested_reviews table takes the form below, and a sqlalchemy connection object has been configured, and made available for you via the db_engine variable. pandas has also been loaded as pd.

nested_reviews table, showing sample data.

Instructions

100 XP
  • Use Postgres JSON to retrieve the value stored at the statement key in the review column, for each record in the nested_reviews table.
  • Only return results with a branch nested in the location object of the review column equal to 'Disneyland_California'.