Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) Could not decode to UTF-8 column #17

Open
ivbeg opened this issue Aug 11, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ivbeg
Copy link
Collaborator

ivbeg commented Aug 11, 2022

Error processing SQLite database with non-unicode names for fields.
Example 000012_world.zip

`Traceback (most recent call last):
File "C:\Users\ibegt\AppData\Roaming\Python\Python310\site-packages\sqlalchemy\engine\result.py", line 1284, in fetchall
l = self.process_rows(self._fetchall_impl())
File "C:\Users\ibegt\AppData\Roaming\Python\Python310\site-packages\sqlalchemy\engine\result.py", line 1230, in _fetchall_impl
return self.cursor.fetchall()
sqlite3.OperationalError: Could not decode to UTF-8 column 'name' with text '\ufffdland Islands'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Program Files\Python310\Scripts\metacrafter-script.py", line 33, in
sys.exit(load_entry_point('metacrafter==0.0.2', 'console_scripts', 'metacrafter')())
File "C:\Program Files\Python310\lib\site-packages\metacrafter-0.0.2-py3.10.egg\metacrafter_main_.py", line 12, in main
exit_status = cli()
File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Program Files\Python310\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "C:\Program Files\Python310\lib\site-packages\metacrafter-0.0.2-py3.10.egg\metacrafter\core.py", line 464, in scan_db
acmd.scan_db(
File "C:\Program Files\Python310\lib\site-packages\metacrafter-0.0.2-py3.10.egg\metacrafter\core.py", line 359, in scan_db
items = [dict(u) for u in queryres.fetchall()]
File "C:\Users\ibegt\AppData\Roaming\Python\Python310\site-packages\sqlalchemy\engine\result.py", line 1288, in fetchall
self.connection.handle_dbapi_exception(
File "C:\Users\ibegt\AppData\Roaming\Python\Python310\site-packages\sqlalchemy\engine\base.py", line 1510, in handle_dbapi_exception
util.raise
(
File "C:\Users\ibegt\AppData\Roaming\Python\Python310\site-packages\sqlalchemy\util\compat.py", line 182, in raise

raise exception
File "C:\Users\ibegt\AppData\Roaming\Python\Python310\site-packages\sqlalchemy\engine\result.py", line 1284, in fetchall
l = self.process_rows(self._fetchall_impl())
File "C:\Users\ibegt\AppData\Roaming\Python\Python310\site-packages\sqlalchemy\engine\result.py", line 1230, in _fetchall_impl
return self.cursor.fetchall()
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) Could not decode to UTF-8 column 'name' with text '\ufffdland Islands'
(Background on this error at: http://sqlalche.me/e/13/e3q8)
`

@ivbeg
Copy link
Collaborator Author

ivbeg commented Sep 1, 2022

It's caused by column names with non utf-8 encoding, it's possible with some SQLite databases. Possible solution here https://stackoverflow.com/questions/22751363/sqlite3-operationalerror-could-not-decode-to-utf-8-column
it could resolve errors by it will improve data types detection without knowledge of encoding used.
Need further research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant