Using `sql_tokenize()` table function for tokenization.
- 主要言語
- Python
- スター
- 187
- フォーク
- 112
- 平均マージ
- 13時間 29分
- マージ済み PR(30日)
- 17
説明
### What happens?
Original issue here: https://github.com/duckdblabs/duckdb-internal/issues/6733
https://github.com/duckdb/duckdb/pull/20171 introduced a new table function `sql_tokenize`, which takes as input the query and returns the tokens and their category.
Currently in the python client we use a custom implementation somewhere near `PyTokenize` (see [here](https://github.com/duckdb/duckdb-python/blob/89ed9a1d66dcab2455cfd667462f1b90619b2aac/src/duckdb_py/duckdb_python.cpp#L35)). I think this can now be moved over to use the table function instead, making it a bit simpler, and possible to provide more information about tokenization in the future.
### To Reproduce
See above
### OS:
MacOS
### DuckDB Package Version:
latest
### Python Version:
3.14?
### Full Name:
Daniel ten Wolde
### Affiliation:
DuckDB Labs
### What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
### Did you include all relevant data sets for reproducing the issue?
Yes
### Did you include all code required to reproduce the issue?
- [x] Yes, I have
### Did you include all relevant configuration to reproduce the issue?
- [x] Yes, I have
コントリビューションガイド
調査の方向性
src/duckdb_py/duckdb_python.cpp の PyTokenize 付近から始め、Python クライアントが現在どのようにクエリをトークン化しているかを追跡します。その経路を、duckdb/duckdb#20171 で導入されたテーブル関数 sql_tokenize と比較します。完了とは、クライアントがテーブル関数を使用し、返されたトークンとカテゴリを保持することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python, sql
- 領域
- api, database
- issue の種類
- リファクタリング
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100