開始使用免費開始

操作巢狀 JSON 物件

半結構化資料常常包含巢狀物件。這題中,你會練習使用 ->->> 運算子,從 nested_reviews 資料表查詢巢狀資料。提醒一下,這個資料表的結構如下:

nested_reviews table, showing sample data.

和先前一樣,已經將 pandaspd 匯入,並建立連線物件存放在變數 db_engine 中。加油!

本練習屬於課程

NoSQL 入門

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# 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)
編輯並執行程式碼