question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Database list is throwing error , unable to write query in sqllab

See original GitHub issue

A clear and concise description of what the bug is. I am using superset for 4 month now. It was working fine for me but few days back when i tried to open database section it was showing me

Sorry, something went wrong
500 - Internal Server Error

Same with table and user datascoure. Also i am unable to select datasource in sqllab. It is showing nothing there.

Expected results

/databaseview/list/ should show me the list of all database .

Actual results

It is showing error.

Screenshots

for mycompany.superset.com/databaseview/list/ https://i.stack.imgur.com/n5iED.png

Environment

FROM python:3.8-slim RUN apt-get update &&
apt-get install -y build-essential Run apt-get install --no-install-recommends --yes
libssl-dev libffi-dev libsasl2-dev libldap2-dev default-libmysqlclient-dev
firefox-esr wget RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz RUN tar -x geckodriver -zf geckodriver-v0.26.0-linux64.tar.gz -O > /usr/bin/geckodriver RUN chmod +x /usr/bin/geckodriver RUN rm geckodriver-v0.26.0-linux64.tar.gz COPY requirements.txt requirements.txt RUN pip --no-cache-dir install -r requirements.txt COPY . /app WORKDIR /app

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

logs

ERROR:superset.app:Exception on /databaseview/list/ [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/views.py", line 551, in list
    widgets = self._list()
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/baseviews.py", line 1122, in _list
    widgets = self._get_list_widget(
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/baseviews.py", line 1021, in _get_list_widget
    count, lst = self.datamodel.query(
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/models/sqla/interface.py", line 234, in query
    return count, query.all()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3341, in all
    return list(self)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 101, in instances
    cursor.close()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 81, in instances
    rows = [proc(row) for row in fetch]
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 81, in <listcomp>
    rows = [proc(row) for row in fetch]
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 580, in _instance
    _populate_full(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 726, in _populate_full
    dict_[key] = getter(row)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/type_api.py", line 1281, in process
    return process_value(impl_processor(value), dialect)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/sqltypes.py", line 945, in process
    value = bytes(value)
TypeError: string argument without an encoding
ERROR:root:string argument without an encoding
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/marshmallow/utils.py", line 349, in _get_value_for_key
    return obj[key]
TypeError: 'Database' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 83, in wraps
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 153, in wraps
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 1473, in get_list
    return self.get_list_headless(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 1410, in get_list_headless
    _response[API_RESULT_RES_KEY] = _list_model_schema.dump(lst, many=True).data
  File "/usr/local/lib/python3.8/site-packages/marshmallow/schema.py", line 513, in dump
    preresult = marshal(
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 114, in serialize
    ret = [self.serialize(d, fields_dict, many=False,
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 114, in <listcomp>
    ret = [self.serialize(d, fields_dict, many=False,
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 135, in serialize
    value = self.call_and_store(
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 63, in call_and_store
    value = getter_func(data)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 134, in <lambda>
    getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/fields.py", line 243, in serialize
    value = self.get_value(attr, obj, accessor=accessor)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/fields.py", line 186, in get_value
    return accessor_func(check_key, obj, default)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/schema.py", line 415, in get_attribute
    return utils.get_value(attr, obj, default)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/utils.py", line 336, in get_value
    return _get_value_for_keys(key.split('.'), obj, default)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/utils.py", line 341, in _get_value_for_keys
    return _get_value_for_key(keys[0], obj, default)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/utils.py", line 352, in _get_value_for_key
    attr = getattr(obj, key)
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 172, in allows_cost_estimate
    extra = self.get_extra()
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 560, in get_extra
    return self.db_engine_spec.get_extra_params(self)
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 540, in db_engine_spec
    return db_engine_specs.engines.get(self.backend, db_engine_specs.BaseEngineSpec)
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 203, in backend
    sqlalchemy_url = make_url(self.sqlalchemy_uri_decrypted)
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 614, in sqlalchemy_uri_decrypted
    conn.password = self.password
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 287, in __get__
    return self.impl.get(instance_state(instance), dict_)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 721, in get
    value = callable_(state, passive)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 449, in __call__
    return strategy._load_for_state(state, passive)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 427, in _load_for_state
    loading.load_on_ident(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 201, in load_on_ident
    return load_on_pk_identity(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 287, in load_on_pk_identity
    return q.one()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3458, in one
    ret = self.one_or_none()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3427, in one_or_none
    ret = list(self)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 101, in instances
    cursor.close()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 81, in instances
    rows = [proc(row) for row in fetch]
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 81, in <listcomp>
    rows = [proc(row) for row in fetch]
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 580, in _instance
    _populate_full(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 726, in _populate_full
    dict_[key] = getter(row)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/type_api.py", line 1281, in process
    return process_value(impl_processor(value), dialect)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/sqltypes.py", line 945, in process
    value = bytes(value)
TypeError: string argument without an encoding
ERROR:root:string argument without an encoding
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/marshmallow/utils.py", line 349, in _get_value_for_key
    return obj[key]
TypeError: 'Database' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 83, in wraps
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 153, in wraps
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 1473, in get_list
    return self.get_list_headless(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 1410, in get_list_headless
    _response[API_RESULT_RES_KEY] = _list_model_schema.dump(lst, many=True).data
  File "/usr/local/lib/python3.8/site-packages/marshmallow/schema.py", line 513, in dump
    preresult = marshal(
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 114, in serialize
    ret = [self.serialize(d, fields_dict, many=False,
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 114, in <listcomp>
    ret = [self.serialize(d, fields_dict, many=False,
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 135, in serialize
    value = self.call_and_store(
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 63, in call_and_store
    value = getter_func(data)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/marshalling.py", line 134, in <lambda>
    getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/fields.py", line 243, in serialize
    value = self.get_value(attr, obj, accessor=accessor)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/fields.py", line 186, in get_value
    return accessor_func(check_key, obj, default)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/schema.py", line 415, in get_attribute
    return utils.get_value(attr, obj, default)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/utils.py", line 336, in get_value
    return _get_value_for_keys(key.split('.'), obj, default)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/utils.py", line 341, in _get_value_for_keys
    return _get_value_for_key(keys[0], obj, default)
  File "/usr/local/lib/python3.8/site-packages/marshmallow/utils.py", line 352, in _get_value_for_key
    attr = getattr(obj, key)
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 172, in allows_cost_estimate
    extra = self.get_extra()
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 560, in get_extra
    return self.db_engine_spec.get_extra_params(self)
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 540, in db_engine_spec
    return db_engine_specs.engines.get(self.backend, db_engine_specs.BaseEngineSpec)
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 203, in backend
    sqlalchemy_url = make_url(self.sqlalchemy_uri_decrypted)
  File "/usr/local/lib/python3.8/site-packages/superset/models/core.py", line 614, in sqlalchemy_uri_decrypted
    conn.password = self.password
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 287, in __get__
    return self.impl.get(instance_state(instance), dict_)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 721, in get
    value = callable_(state, passive)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 449, in __call__
    return strategy._load_for_state(state, passive)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 427, in _load_for_state
    loading.load_on_ident(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 201, in load_on_ident
    return load_on_pk_identity(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 287, in load_on_pk_identity
    return q.one()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3458, in one
    ret = self.one_or_none()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3427, in one_or_none
    ret = list(self)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 101, in instances
    cursor.close()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 81, in instances
    rows = [proc(row) for row in fetch]
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 81, in <listcomp>
    rows = [proc(row) for row in fetch]
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 580, in _instance
    _populate_full(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 726, in _populate_full
    dict_[key] = getter(row)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/type_api.py", line 1281, in process
    return process_value(impl_processor(value), dialect)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/sqltypes.py", line 945, in process
    value = bytes(value)
TypeError: string argument without an encoding

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
issue-label-bot[bot]commented, Jul 31, 2020

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.63. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

0reactions
transhapHigsncommented, Aug 5, 2020

@villebro using above issue, we finally triaged the issue to records in dbs table where password was not null. As a temporary solution, we have set all passwords to null. I am not sure if this is the right way to go around solving this, do let me know if you have a better solution for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Database list is throwing error , unable to write query in sqllab
A clear and concise description of what the bug is. I am using superset for 4 month now. It was working fine for...
Read more >
Common SQL syntax errors and how to resolve them
In this article, we are going to describe some of the most common SQL syntax errors, and explains how you can resolve these...
Read more >
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
3 common foreign key mistakes (and how to avoid them)
Foreign key constraints are important to any SQL database, but they can also cause problems if they're not implemented correctly.
Read more >
Troubleshooting GitLab Runner
If you get the error Unable to query docker version: Cannot connect to the ... to the list of environment variables available for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found