duckdb / duckdb/duckdb-python

Using `sql_tokenize()` table function for tokenization.

Ouverte
#338 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
needs triage
Langage dominant
Python
Étoiles
187
Forks
112
Merge moyen
13 h 29 min
PR mergées (30 j)
17

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans src/duckdb_py/duckdb_python.cpp près de PyTokenize et suivez la manière dont le client Python tokenize actuellement les requêtes. Comparez ce chemin avec la fonction de table sql_tokenize introduite par duckdb/duckdb#20171 ; le travail est terminé lorsque le client utilise la fonction de table tout en préservant les tokens et les catégories renvoyés.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python, sql
Domaine
api, database
Type d'issue
Refactorisation
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.