新增在 docker 中安装 zeppelin 和 girdb
git clone https://github.com/roenschg/griddb-zeppelin-quikstart.git
cd griddb-zeppelin-quikstart/
docker-compose build docker-compose up
连接到 GridDB
import jaydebeapi
conn = jaydebeapi.connect("com.toshiba.mwcloud.gs.sql.Driver",
"jdbc:gs://griddb:20001/defaultCluster/public?notificationMember:127.0.0.1:20001",
["admin", "admin"],
"/usr/share/java/gridstore-jdbc-4.5.0.jar",)
为此,使用 SQL 查询和 Pandas 函数之一访问您的 GridDB 表,将数据直接提供给数据帧:
*sql = ("SELECT * FROM iotdata WHERE TIMESTAMP(timestamp) < TIMESTAMP_ADD(DAY, NOW(), -5)")
iotdf = pd.read_sql_query(sql, conn)*
输出
---------------------------------------------------------------------------
*NameError Traceback (most recent call last)
<ipython-input-5-ac103e118435> in <module>
1 sql = ("SELECT * FROM iotdata WHERE TIMESTAMP(timestamp) < TIMESTAMP_ADD(DAY, NOW(), -5)")
----> 2 iotdf = pd.read_sql_query(sql, conn)
NameError: name 'pd' is not defined*