SingleStore 連接器

SingleStore 連接器允許在外部 SingleStore 資料庫中查詢和建立資料表。這可以用於在不同的系統(如 SingleStore 和 Hive)之間,或在兩個不同的 SingleStore 實例之間聯結資料。

組態

若要設定 SingleStore 連接器,請在 etc/catalog 中建立一個目錄屬性檔案,例如,命名為 singlestore.properties,將 SingleStore 連接器掛載為 singlestore 目錄。建立具有下列內容的檔案,並根據您的設定適當取代連線屬性

connector.name=singlestore
connection-url=jdbc:singlestore://127.0.0.1:3306
connection-user=root
connection-password=LbRootPass1

connection-url 定義要傳遞給 SingleStore JDBC 驅動程式的連線資訊和參數。URL 支援的參數可在 SingleStore 連線字串參數中找到。

connection-userconnection-password 通常是必需的,並決定連線的使用者憑證,通常是服務使用者。

多個 SingleStore 伺服器

您可以根據需要擁有任意數量的目錄,因此如果您有其他 SingleStore 伺服器,只需在 etc/catalog 中新增另一個具有不同名稱的屬性檔案(確保它以 .properties 結尾)。例如,如果您將屬性檔案命名為 sales.properties,Presto 將使用設定的連接器建立名為 sales 的目錄。

查詢 SingleStore

SingleStore 連接器會為每個 SingleStore *資料庫* 提供一個結構描述。您可以執行 SHOW SCHEMAS 來查看可用的 SingleStore 資料庫

SHOW SCHEMAS FROM singlestore;

如果您有一個名為 web 的 SingleStore 資料庫,您可以執行 SHOW TABLES 來查看此資料庫中的資料表

SHOW TABLES FROM singlestore.web;

您可以使用以下任一方式,查看 web 資料庫中 clicks 資料表的欄位清單

DESCRIBE singlestore.web.clicks;
SHOW COLUMNS FROM singlestore.web.clicks;

最後,您可以存取 web 資料庫中的 clicks 資料表

SELECT * FROM singlestore.web.clicks;

如果您為您的目錄屬性檔案使用不同的名稱,請在上述範例中使用該目錄名稱,而不是 singlestore

SingleStore 連接器限制

不支援以下 SQL 陳述式