duckdb / duckdb/duckdb-python

Using `sql_tokenize()` table function for tokenization.

Abierto
#338 0 comentarios 1 reacción 0 asignados Ver en GitHub
needs triage
Lenguaje dominante
Python
Estrellas
187
Forks
112
Merge medio
13 h 29 min
PR fusionados (30 d)
17

Descripción

### 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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en src/duckdb_py/duckdb_python.cpp cerca de PyTokenize y sigue cómo el cliente de Python tokeniza actualmente las consultas. Compara ese recorrido con la función de tabla sql_tokenize introducida por duckdb/duckdb#20171; se considera terminado cuando el cliente utiliza la función de tabla y conserva los tokens y las categorías devueltos.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python, sql
Área
api, database
Tipo de issue
Refactorización
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.