MulaiMulai sekarang secara gratis

Working with nested JSON objects

Often, semi-structured data includes nested working with nested objects. In this exercise, you'll practice using the -> and ->> operators to query nested data from the nested_reviews table. As a reminder, this table takes the following form:

nested_reviews table, showing sample data.

Similar to before, pandas has been imported as pd, and a connection object has been created and stored in the db_engine variable. Best of luck!

Latihan ini adalah bagian dari kursus

Introduction to NoSQL

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Build the query to select the object stored at the 
# location key
query = """
SELECT 
	review -> '____'
FROM nested_reviews;
"""

# Execute the query, render results
data = pd.read_sql(query, db_engine)
print(data)
Edit dan Jalankan Kode