-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cursors to optionally return dict with column names #235
base: master
Are you sure you want to change the base?
Conversation
…d with column names for keys
Codecov Report
@@ Coverage Diff @@
## master #235 +/- ##
==========================================
- Coverage 99.04% 98.31% -0.73%
==========================================
Files 145 145
Lines 3135 3385 +250
==========================================
+ Hits 3105 3328 +223
- Misses 30 57 +27
Continue to review full report at Codecov.
|
According to https://www.python.org/dev/peps/pep-0249/#frequently-asked-questions this API was omitted for a reason, we should thus also omit it here, too. |
Unfortunate situation of lowest common denominator. Does it make a difference the default is off and this is optional? |
I would rather provide a separate API that returns the dicts. What about |
That can work too, I’ll adjust to whatever is preferred. One library I used called pymysql allowed the choice of output types over the same APIs. In turbodbc’s case, they would have something like an enum property such as as_type instead of as_dict, then allowed values such as None, Dict, Numpy, Arrow. Just another approach. Which is preferred? |
I prefer APIs were the types don't depend on the internal state of an object, i.e. having different methods that for each return type. @fjetter @MathMagique feel free to weigh in here. |
I feel the same way. In particular we're exercising the principle already for arrow and numpy |
Optionally have one or all cursors return results as a dictionary with the column names as keys.
set every cursor to return dict by default
my_connection.as_dict = True
set one cursor to return dict by default