Skip to content

Commit

Permalink
add content to v0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
nicecui committed Jan 8, 2025
1 parent 5b690d7 commit da9b6bd
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
keywords: [MindsDB, 机器学习平台, 数据库集成, 配置示例, SQL]
description: 介绍如何使用 MindsDB 将 GreptimeCloud 实例集成到机器学习平台,并提供了配置示例。
---

# MindsDB

[MindsDB](https://mindsdb.com/) 是一个开源的机器学习平台,使开发人员能够轻松地将
先进的机器学习能力与现有数据库集成。

使用 MindsDB 扩展,你的 GreptimeDB 实例可以开箱即用。
你可以使用 MySQL 协议将 GreptimeDB 配置为 MindsDB 中的数据源:

```sql
CREATE DATABASE greptime_datasource
WITH ENGINE = 'greptimedb',
PARAMETERS = {
"host": "<host>",
"port": 4002,
"database": "<dbname>",
"user": "<username>",
"password": "<password>",
"ssl": True
};

```

- `<host>` 是你的 GreptimeDB 实例的主机名或 IP 地址。
- `<dbname>` 是你想要连接的数据库名称。
- `<username>``<password>` 是你 [GreptimeDB 的鉴权信息](/user-guide/deployments/authentication/static.md)

MindsDB 是许多机器学习功能的优秀门户,包括您存储在我们实例中的时间序列数据的时间序列预测。
访问 [MindsDB docs](https://docs.mindsdb.com/what-is-mindsdb) 了解更多。
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ GreptimeDB 可以与流行的数据写入、查询和可视化工具无缝集成
import DocCardList from '@theme/DocCardList';

<DocCardList />

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
keywords: [Streamlit, 数据应用, SQL 连接, MySQL 协议, Python]
description: 使用 GreptimeCloud 和 Streamlit 构建数据应用的说明,包括创建 SQL 连接和运行 SQL 查询。
---

# Streamlit

[Streamlit](https://streamlit.io/) 是一种更快的构建和分享数据应用的方式。
可以基于 GreptimeDB 构建基于 Streamlit 的数据应用。

你需要创建一个 SQL 连接在应用程序中使用 GreptimeDB 数据。
由于 GreptimeDB 的 [MySQL 协议兼容性](/user-guide/protocols/mysql.md),你可以在连接时将 GreptimeDB 视为 MySQL。

以下是从 Streamlit 连接到 GreptimeDB 的示例代码片段:

```python
import streamlit as st

st.title('GreptimeDB Streamlit 演示')
conn = st.connection("greptimedb", type="sql", url="mysql://<username>:<password>@<host>:4002/<dbname>")

df = conn.query("SELECT * FROM ...")
```

- `<host>` 是 GreptimeDB 实例的主机名或 IP 地址。
- `<dbname>` 是要连接的数据库的名称。
- `<username>``<password>`[GreptimeDB 鉴权认证信息](/user-guide/deployments/authentication/static.md)

创建连接后,你可以对 GreptimeDB 实例运行 SQL 查询。结果集会自动转换为 Pandas dataframe,就像在 Streamlit 中使用普通数据源一样。
35 changes: 35 additions & 0 deletions versioned_docs/version-0.11/user-guide/integrations/mindsdb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
keywords: [MindsDB, machine learning, data source, configuration, SQL]
description: Guide on configuring GreptimeCloud as a data source in MindsDB for machine learning capabilities.
---

# MindsDB

[MindsDB](https://mindsdb.com/) is an open-source machine learning platform that
enables developers to easily incorporate advanced machine learning capabilities
with existing databases.

Your GreptimeDB instance work out of box as using GreptimeDB extension with
MindsDB. You can configure GreptimeDB as a data source in MindsDB using MySQL protocol:

```sql
CREATE DATABASE greptime_datasource
WITH ENGINE = 'greptimedb',
PARAMETERS = {
"host": "<host>",
"port": 4002,
"database": "<dbname>",
"user": "<username>",
"password": "<password>",
"ssl": True
};

```

- `<host>` is the hostname or IP address of your GreptimeDB instance.
- `<dbname>` is the name of the database you want to connect to.
- `<username>` and `<password>` are your [GreptimeDB credentials](/user-guide/deployments/authentication/static.md).

MindsDB is a great gateway for many machine learning features, including
time-series forecasting, for your time series data stored in our instance. See
[MindsDB docs](https://docs.mindsdb.com/what-is-mindsdb) for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ The subsequent sections offer comprehensive guidance on integrating GreptimeDB w
import DocCardList from '@theme/DocCardList';

<DocCardList />

33 changes: 33 additions & 0 deletions versioned_docs/version-0.11/user-guide/integrations/streamlit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
keywords: [Streamlit, data apps, SQL connection, MySQL protocol, Python]
description: Instructions for using GreptimeCloud with Streamlit to build data apps, including creating a SQL connection and running SQL queries.
---

# Streamlit

[Streamlit](https://streamlit.io/) is a faster way to build and share data apps.
It's possible to build streamlit based data apps based on GreptimeDB.

To use GreptimeDB data in your application, you will need to create a SQL
connection. Thanks to GreptimeDB's [MySQL protocol compatibility](/user-guide/protocols/mysql.md),
you can treat GreptimeDB as MySQL when connecting to it.

Here is an example code snippet to connect to GreptimeDB from Streamlit:

```python
import streamlit as st

st.title('GreptimeDB Streamlit Demo')
conn = st.connection("greptimedb", type="sql", url="mysql://<username>:<password>@<host>:4002/<dbname>")

df = conn.query("SELECT * FROM ...")
```

- The `<host>` is the hostname or IP address of your GreptimeDB instance.
- The `<dbname>` is the name of the database you want to connect to.
- The `<username>` and `<password>` are your [GreptimeDB credentials](/user-guide/deployments/authentication/static.md).

Once you have created the connection, you can run SQL query against your
GreptimeDB instance. The resultset is automatically converted to Pandas
dataframe just like normal data source in streamlit.

0 comments on commit da9b6bd

Please sign in to comment.