Amazon Redshift 將不再支援在 2026 年 6 月 30 日之後使用 Python UDFs。我們將開始分階段強制執行。如需 Python 生命週期結束和遷移選項的詳細資訊,請參閱 2025 年 6 月 30 日發佈的部落格文章
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
範例:在 Redshift Spectrum 中執行相互關聯子查詢
本主題說明如何在 Redshift Spectrum 中執行相互關聯子查詢。相互關聯子查詢是使用外部查詢值的查詢。
您可以在 Redshift Spectrum 中執行相互關聯子查詢。$spectrum_oid 虛擬資料欄提供使用 Redshift Spectrum 執行相關查詢的能力。若要執行相互關聯子查詢,虛擬資料欄 $spectrum_oid 必須啟用,但不會出現在 SQL 陳述式中。如需詳細資訊,請參閱虛擬資料欄。
若要為此範例建立外部結構描述和外部資料表,請參閱開始使用 Amazon Redshift Spectrum。
以下是 Redshift Spectrum 中的相互關聯子查詢範例。
select * from myspectrum_schema.sales s where exists ( select * from myspectrum_schema.listing l where l.listid = s.listid ) order by salesid limit 5;
salesid listid sellerid buyerid eventid dateid qtysold pricepaid commission saletime
1 1 36861 21191 7872 1875 4 728 109.2 2008-02-18 02:36:48
2 4 8117 11498 4337 1983 2 76 11.4 2008-06-06 05:00:16
3 5 1616 17433 8647 1983 2 350 52.5 2008-06-06 08:26:17
4 5 1616 19715 8647 1986 1 175 26.25 2008-06-09 08:38:52
5 6 47402 14115 8240 2069 2 154 23.1 2008-08-31 09:17:02