MagicStack / MagicStack/asyncpg
Not accepting str as value for interval/date columns
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 8.1k
- Fork
- 468
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
- asyncpg version: 0.29.0
- PostgreSQL version: 15.7
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: local - Python version: 3.11
- Platform: Windows
- Do you use pgbouncer?: No
- Did you install asyncpg with pip?: Yes
- If you built asyncpg locally, which version of Cython did you use?: N/A
- Can the issue be reproduced under both asyncio and
uvloop?: yes
I am using asyncpg as the driver for SQLAlchemy.
class Table(Base):
__tablename__ = 'table'
interval: Mapped[timedelta]
session.add(Table(interval='1 min'))
With the above code, it throws this error:
sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.DataError'>: invalid input for query argument $9: '1 min' ('str' object has no attribute 'days')
However, Postgresql accepts '1 min' as a value to an interval column. Why is asyncpg forbidding str even though Postgresql accepts it in this case?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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.
Direzione di ricerca
Inizia riproducendo l'esempio SQLAlchemy con la configurazione indicata di PostgreSQL 15.7 e Python 3.11, quindi traccia la gestione dei parametri di asyncpg per i valori interval e date. Confronta gli input stringa con la sintassi interval accettata da PostgreSQL e aggiungi una copertura di regressione che acquisisca il risultato previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- postgresql, python, sqlalchemy
- Ambito
- databases
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100