Nested array columns cannot be created

Aperta
#310 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, sqlalchemy

Direzione di ricerca

The issue is in the compiler at src/sqlalchemy_cratedb/compiler.py lines 291-293. Start by understanding how SQLAlchemy's ARRAY type with dimensions works. The fix involves modifying the type compiler to handle the dimensions parameter and emit nested ARRAY(...) syntax for CrateDB. Test by creating a nested array column and verifying it works with reflection. Check test files for existing array-related tests to extend.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

crate stores arrays of arrays: ARRAY(ARRAY(INTEGER)) holds [[1, 2], [3]], and information_schema.columns reports the type as integer_array_array. The dialect cannot create such a column. SQLAlchemy refuses to nest the type itself:

sa.ARRAY(sa.ARRAY(sa.INTEGER))
ValueError: Do not nest ARRAY types; ARRAY(basetype) handles multi-dimensional arrays of basetype

and the form it offers instead is refused by the dialect's type compiler, with a reason that no longer holds:

sa.ARRAY(sa.INTEGER, dimensions=2)
NotImplementedError: CrateDB doesn't support multidimensional arrays

https://github.com/crate/sqlalchemy-cratedb/blob/dfc2145aa4bf28a6964d2d0ba99a549cf26827e2/src/sqlalchemy_cratedb/compiler.py#L291-L293

So reflection leaves these columns as UnresolvedType (#301). The dialect should support them: rendering dimensions=n as n nested ARRAY(...) lets the compiler emit them, and reflection can then resolve <element>_array_array names to that form.

Lingua principale
Python
Stelle
9
Fork
6
Merge medio
6g 13h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di crate/sqlalchemy-cratedb

Tutte le issue di crate/sqlalchemy-cratedb

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.