Open jstastny-cz opened 7 years ago
Same here. https://github.com/mkleehammer/pyodbc/wiki/Cursor#description docs suggests that it returns just that:
- type code
but instead it returns Python type that values will be mapped to (e.g. str
, int
, datetime.time
etc.)
@mkleehammer is there a way to get original (ODBC-level) type information?
@findepi Hello, there is a way. You can get it from the odbc driver. Actually, I've implemented the extension in my fork of this project, if you're interested.
@jstastny-cz , is it Cursor#colinfos
(https://github.com/jstastny-cz/pyodbc/blob/c278e74e44341a4333dbd2b471758b651abc7558/src/cursor.h#L112)?
Looks like that would be it! Are you planning on making a PR with this enhancement?
@findepi Not that one.
I exposed the information in an additional field 'coldescription': https://github.com/jstastny-cz/pyodbc/blob/2f703c07a98c70ac369e77603abd98e681204421/src/cursor.h#L117
and the PR is already in place (it never got into the project, as it is not project's priority I am afraid): https://github.com/mkleehammer/pyodbc/pull/168
I am looking for an extension of metadata returned through Cursor. For every column in a result set I'd like to be able to get sql_type code of that column. Together with getTypeInfo method of cursor, user can get further information about the datatype.