Hi Python SQLite experts,
I was trying to use sqlalchemy to get the metadata of the result of arbitrary SQL queries on a SQLite table. Following the suggestion
here, I tried to access the `description` attribute of the `cursor`. I created my table with:
```
sqlite3 /tmp/sqlite.db
CREATE TABLE table1(string_col TEXT, int_col INT);
pragma table_info('table1');
```
and saw the expected schema:
```
0|string_col|TEXT|0||0
1|int_col|INT|0||0
```
When I try to get the metadata for a query selecting all rows from the table with:
```
import sqlite3
connection = sqlite3.connect("/tmp/sqlite.db")
cursor = connection.execute("SELECT * FROM table1")
print([col for col in cursor.description])
```
I get out:
```
[('string_col', None, None, None, None, None, None), ('int_col', None, None, None, None, None, None)]
```
but according to the
documentation of `Cursor.description` in PEP 249, the columns
must each provide a `type_code` that compares correctly to sqlite3's
type objects.
I originally tried to get the metadata through sqlalchemy, but the solution given in the StackOverflow answer linked above gives the same results:
```
('string_col', None, None, None, None, None, None)
('int_col', None, None, None, None, None, None)
```
I think that the bug in sqlite3 prevents sqlalchemy from getting the right type codes.
If this is indeed a bug, I'm happy to help fix it. I would need some pointers to the relevant source code, though.