4paradigm / 4paradigm/OpenMLDB

Mock commit statement for open-mysql-db by using panda dataframe

オープン
#3,850 コメント 0 件 リアクション 0 件 担当者 1 名 @yangwucheng が担当を希望しています GitHub で見る
主要言語
C++
スター
1.7k
フォーク
331
平均マージ
12日 12時間
マージ済み PR(30日)
1

説明

**Describe the feature you'd like**

Now we are using sqlalchemy and pandas dataframe. The method of "to_sql" is not supported which uses commit statements.

Here is the example code.

```
import pandas as pd
from sqlalchemy import create_engine

# Create a Pandas DataFrame (replace this with your actual data)
data = {'id': [1, 2, 3],
'name': ['Alice', 'Bob', 'Charlie'],
'age': [25, 30, 35]}
df = pd.DataFrame(data)

# Create a MySQL database engine using SQLAlchemy
engine = create_engine('mysql://username:password@host/db_name')

# Replace 'username', 'password', 'host', and 'db_name' with your actual database credentials

# Define the name of the table in the database where you want to write the data
table_name = 'your_table_name'

# Write the DataFrame 'df' into the MySQL table
df.to_sql(table_name, engine, if_exists='replace', index=False)

# 'if_exists' parameter options:
# - 'fail': If the table already exists, an error will be raised.
# - 'replace': If the table already exists, it will be replaced.
# - 'append': If the table already exists, data will be appended to it.

print("Data written to MySQL table successfully!")
```

And we may get the error like this.

```
[1002] create logic plan tree failed--Un-support statement type: CommitStatement'
```

**Additional context**

Add any other context or screenshots about the feature request here.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

The issue is about supporting commit statements when using pandas DataFrame.to_sql with SQLAlchemy on OpenMLDB. Look at the OpenMLDB SQL engine's handling of CommitStatement. Start by searching for 'CommitStatement' in the codebase, likely in the SQL parser or planner. Check how other statement types are supported and see where commit logic needs to be added. Run the provided example to reproduce the error and verify the fix.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
mysql, pandas, python, sqlalchemy
領域
data-engineering, databases, machine-learning
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。