ai-cfia / ai-cfia/ailab-datastore

As a dev, I want to handle cursor creation inside the query functions in `fertiscan`

Offen
#169 5 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @k-allagbe Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
3
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## Description

**Context**
Currently, the functions in the datastore assume that a `psycopg` cursor is passed to them, presuming it was created with default configurations (tuple-based rows). However, to handle different cursor configurations, such as `row_factory=dict_row`, it would be better to pass the connection (`conn`) instead and create the cursor as needed within the function.

**Problem Statement**
The current approach of passing cursors assumes a specific configuration, limiting flexibility and causing errors when non-default configurations like `row_factory=dict_row` are used. By passing the connection and moving cursor creation closer to the SQL queries, we gain more control over how the cursor is created, ensuring compatibility and making the code more robust.

## Acceptance Criteria

- Pass the database connection (`conn`) instead of cursors to datastore functions.
- Create the cursor inside the functions that contain the actual SQL queries, allowing flexibility in choosing the cursor configuration.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.