Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Bulk Copy Handles Decimal Inconsistently Compared with Normal Queries

Aperta
#457 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Theekshna ci sta già lavorando.

Dal 2/3/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

area: bulk-copy triage needed
Describe the bug

Trying to insert into a Decimal column with the new bulk_copy can throw an exception regarding mismatched decimal scale, whereas a normal insert will succeed and automatically deal with the issue. I would like to see bulk_copy work similarly and seamlessly.

To reproduce
import mssql_python
from decimal import Decimal

conn = mssql_python.connect([conn string], autocommit=True)
cur = conn.cursor()
cur.execute('create table dectest (d decimal(10, 2));')

# This next line works fine
cur.execute('insert into dectest values (?)', Decimal('123.456'))

# This line fails with the below exception
cur.bulkcopy('dectest', (Decimal('123.456'),))
Exception message
ValueError: Input decimal scale 3 exceeds target scale 2
Expected behavior

The bulkcopy should succeed and the value should be automatically rounded as it is in the insert.

Lingua principale
Python
Stelle
478
Fork
62
Merge medio
3g 19m
PR unite (30g)
28

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 microsoft/mssql-python

Tutte le issue di microsoft/mssql-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.