crate / crate-python

Python DB API client library for CrateDB, using HTTP.
https://cratedb.com/docs/python/
Apache License 2.0
79 stars 30 forks source link

The following error occurred while using crate under superset #307

Closed javyxu closed 5 years ago

javyxu commented 6 years ago

When I use cratedb under superset, the following error will occur when only adding tables.How to solve it? image

jodok commented 6 years ago

thanks for trying it @javyxu :) is there a chance you can find out the failing query? either in superset, or by set global stats.enabled=true and looking at sys.jobs_log?

javyxu commented 6 years ago

this is logs:

Traceback (most recent call last):
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 26, in wraps
    return f(self, *args, **kwargs)
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/superset/models/core.py", line 903, in wrapper
    value = f(*args, **kwargs)
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/superset/views/core.py", line 2264, in table
    return json_success(json.dumps(tbl))
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/simplejson/__init__.py", line 382, in dumps
    return _default_encoder.encode(obj)
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/simplejson/encoder.py", line 296, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/simplejson/encoder.py", line 378, in iterencode
    return _iterencode(o, 0)
  File "/home/superset/Downloads/env/local/lib/python2.7/site-packages/simplejson/encoder.py", line 273, in default
    o.__class__.__name__)
TypeError: Object of type set is not JSON `serializable

this is picture:

image

this is Python2.7, This problem will still occur in my python3.6 test

jodok commented 6 years ago

we would need the sql statement, not the python traceback...

javyxu commented 6 years ago

Are these what you want to see?

image

Here's his details: DEBUG:crate.client.http:JSON response for stmt(SELECT column_name FROM information_schema.key_column_usage WHERE table_name = ? AND table_catalog = ?): {'cols': ['column_name'], 'rows': [], 'rowcount': 0, 'duration': 0.627271}

joemoe commented 6 years ago

hi @javyxu, we don't support the key_column_usage table in the information_schema schema. i added this to our backlog and will get back to you once this is released. as we are constantly increasing our postgresql compatibility this is something is of interest to us. thanks, joe

kovrus commented 5 years ago

Hi @javyxu,

You can use Superset with CrateDB ( >=3.2) using its crate-python client.

Please note that if a source table contains timestamp columns, you would have to edit the table metadata and explicitly provide the datatime format for those columns.

image

javyxu commented 5 years ago

OK, Thank you!