Reflected NUMERIC columns lose their precision and scale
I maintainer di solito rispondono entro 4 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
Look at the reflection code in the dialect, likely in a file like dialect.py or reflection.py. The issue mentions reading from information_schema.columns; find where column types are constructed. You'll need to add reading of numeric_precision and numeric_scale when both are present. Test with a CrateDB instance to ensure the reflected column retains its precision and scale. Check for any existing tests for numeric column reflection.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When SQLAlchemy reflects a table, this dialect reads each column's type from information_schema.columns. It asks only for data_type, which holds the bare type name: numeric (and nothing else). The precision and scale sit in two other columns, numeric_precision and numeric_scale, which the dialect never reads. So the column comes back as a bare NUMERIC:
reflected NUMERIC(10, 2) NUMERIC()
Two things go wrong because of it:
- The read value is correct, but its form changes slightly: SQLAlchemy formats it with the column's scale, and without one it falls back to ten decimal places.
read a stored 1.25 Decimal('1.2500000000') # reads with default 10 precision
- Creating the column needs the precision, because crate refuses a
NUMERICcolumn without one, so the dialect raisesCompileErrorbefore sending the DDL.
CREATE TABLE from it CompileError: CrateDB stores a NUMERIC column only with a precision, as in Numeric(precision=10, scale=2)
crate reports the precision today and that we could implement immediately (in theory), but the scale only comes with crate/crate#20275, which is planned for 6.4.6, so the dialect's reflection should read both (this ticket) only once it ships.
Also, it should only use them only when both are present.
An older server reports NUMERIC(10, 2) as precision 10 with a null scale, and reading that as NUMERIC(10) would drop the decimals of copied tables.
Arrays of NUMERIC report neither value even with that fix (see the example here => so reflected arrays stay without precision for now.
- Lingua principale
- Python
- Stelle
- 9
- Fork
- 6
- Merge medio
- 6g 13h
- PR unite (30g)
- 8
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di crate/sqlalchemy-cratedb
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
crate/sqlalchemy-cratedb#310 ·
I maintainer di solito rispondono entro 4 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
crate/sqlalchemy-cratedb#308 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
crate/sqlalchemy-cratedb#284 · 3 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
Refactor rewrite_update() for cleaner bind parameter key representationForse di nuovo libera @bgunebakan l’ha presa 175 giorni fa e non c’è nessuna pull request aperta. Aperta
crate/sqlalchemy-cratedb#270 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
crate/sqlalchemy-cratedb#269 ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di crate/sqlalchemy-cratedb
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
hugohe3/ppt-master#366 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 89/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
521xueweihan/HelloGitHub#4716 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
pcqpcq/open-source-android-apps#619 ·
I maintainer di solito rispondono entro 1 giorno
-
contribution Windows 主机
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Lee-xeo/Claude-Cage#1519 ·
I maintainer di solito rispondono entro 1 giorno