-
Notifications
You must be signed in to change notification settings - Fork 50
Add .to_dict to Row objects #606
Copy link
Copy link
Open
Labels
area: api-compliancePython API behavior and typing: DB-API 2.0, exceptions, type stubs, new APIs.Python API behavior and typing: DB-API 2.0, exceptions, type stubs, new APIs.enhancementNew feature or requestNew feature or requestinADO
Metadata
Metadata
Assignees
Labels
area: api-compliancePython API behavior and typing: DB-API 2.0, exceptions, type stubs, new APIs.Python API behavior and typing: DB-API 2.0, exceptions, type stubs, new APIs.enhancementNew feature or requestNew feature or requestinADO
Type
Fields
Give feedbackNo fields configured for Feature.
Is your feature request related to a problem? Please describe.
I've just finished testing the newly released row-string indexing feature. It's great and extremely handy for cases where a mapping interface is needed. However, I think it can go a bit further: Sometimes we need to pass a true dict into some legacy thing, and here mssql-python could help, by providing a built-in
to_dict()function.Describe the solution you'd like
I would like a function on the
Rowobject that will return a Pythondictwith all of the row's values.Describe alternatives you've considered
Interrogating the cursor's
descriptionproperty and producing my own dict is easy enough. But it would certainly be a lot easier, and probably faster, to let mssql-python do the work instead.Thank you!