Issue: Exception if sqlite database contains an incorrect type
Author: huntfx
State: closed
Created: 2019-09-02 14:14:03

This is an issue I got in your `sqlite-web` script, but it appears to be specific to `peewee` so posting here.

Due to a bug in my code, I had some text stored in an integer column. Querying with both `sqlalchemy` and [sqliteonline](https://sqliteonline.com) worked and showed the strings that were in my integer column, and from a [quick search](https://dba.stackexchange.com/questions/106364/text-string-stored-in-sqlite-integer-column) it appears this is technically valid behaviour for sqlite.

While having strings in an integer column is definitely not expected or wanted behaviour, it seems to be fully supported by other scripts. I'm not sure if there's any metadata on individual records, but even just a simple try/except looks like it'd be fine for this case.

Here's a screenshot from `sqliteonline` showing it supporting the dodgy column:

![image](https://user-images.githubusercontent.com/10235666/64120076-32f03380-cd93-11e9-8135-71229096f0c4.png)

The full traceback is here:
```
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Python27\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Python27\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\sqlite_web\sqlite_web.py", line 213, in inner
    return fn(table, *args, **kwargs)
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\sqlite_web\sqlite_web.py", line 463, in table_content
    total_rows=total_rows)
  File "C:\Python27\lib\site-packages\flask\templating.py", line 135, in render_template
    context, ctx.app)
  File "C:\Python27\lib\site-packages\flask\templating.py", line 117, in _render
    rv = template.render(context)
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\jinja2\environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\jinja2\environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\sqlite_web\templates\table_content.html", line 1, in top-level template code
    {% extends "base_table.html" %}
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\sqlite_web\templates\base_table.html", line 1, in top-level template code
    {% extends "base_tables.html" %}
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\sqlite_web\templates\base_tables.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\sqlite_web\templates\base.html", line 62, in top-level template code
    {% block content %}{% endblock %}
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\sqlite_web\templates\base_table.html", line 29, in block "content"
    {% block inner_content %}
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\sqlite_web\templates\table_content.html", line 39, in block "inner_content"
    {% for row in query %}
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\peewee.py", line 4097, in next
    self.cursor_wrapper.iterate()
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\peewee.py", line 4016, in iterate
    result = self.process_row(row)
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\peewee.py", line 6974, in process_row
    result[attr] = converters[i](row[i])
  File "C:\Users\peterh\AppData\Roaming\Python\Python27\site-packages\peewee.py", line 4263, in python_value
    return value if value is None else self.adapt(value)
ValueError: invalid literal for int() with base 10: 'Manual'
```