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

Connected

Exercise

Extracting keys from JSON objects with Postgres

When getting your feet wet with semi-structured data, you'll often be curious about the different keys that exist in a set of JSON objects. In this exercise, you'll practice doing just this with Postgres' built-in JSON functionality.

Like before, pandas has been imported as pd, as well as a connection object, which is available via the variable db_engine. Go get 'em!

Instructions

100 XP
  • Write a query to create a result set containing the unique set of keys in the JSON objects stored in the review column of the nested_reviews table.
  • Store the result set in a variable with name unique_keys, and output the results. Validated that there are two keys in this DataFrame.