Aan de slagGa gratis aan de slag

Querying document databases

Using Postgres JSON to query document data is similar to querying relational data with Postgres. In this exercise, you'll practice building a query to retrieve document data from the nested_reviews table, with Postgres JSON. Happy querying!

Deze oefening maakt deel uit van de cursus

Introduction to NoSQL

Cursus bekijken

Oefeninstructies

  • Update the query to return the review column from the nested_reviews table.
  • Use the appropriate pandas function to create a DataFrame using the logic stored in the query variable.
  • Output the first record in the DataFrame returned after executing the query.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Update the query to select the review field
query = """
	SELECT 
    	____
    FROM nested_reviews;
"""

# Execute the query
data = ____.____(query, db_engine)

# Print the first element of the DataFrame
____(data.iloc[0, 0])
Code bewerken en uitvoeren