imavo opened a new issue, #24130:
URL: https://github.com/apache/superset/issues/24130

   A clear and concise description of what the bug is.
   
    "ERROR:flask_appbuilder.api:Object of type LegacyRow is not JSON 
serializable"  , exception shown in docker-compose logs output when attempting 
to use a table in an IBM-DB2-LUW database (with the latest docker-compose 
locally installed version).
   
   #### How to reproduce the bug
   
   1. Download the docker-compose local installation of superset as per 
https://superset.apache.org/docs/installation/installing-superset-using-docker-compose/
   2. Adjust the ./docker/requirements-local.txt to add two modules:  
ibm_db=3.1.4 , and ibm_db_sa==0.4.0 and then run the docker-compose up  and 
wait for it to finisish initialising itself.
   3. Login to superset via chromium on the host (with admin/admin), and add a 
new datasource of type IBM-DB2 (successfully) , then try adding a table in that 
database in your chosen schema (which is the same as the connecting-userid).
   4. Observe the exception in the docker-logs output when attempting to add 
that table.
   
   
   ### Expected results
   
   Expected to be able to add the tables from the IBM-DB2 database without 
getting exceptions.
   
   ### Actual results
   
   The table does not get added to Superset, because of the exception in 
get_table_metadata()
   
   #### Screenshots
   (fragment from the `docker-compose logs` output, showing the exception:
   
   superset_app            | 127.0.0.1 - - [12/May/2023:13:01:04 +0000] "GET 
/health HTTP/1.1" 200 2 "-" "curl/7.74.0"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:18 +0000] "GET 
/api/v1/database/?q=(filters:!((col:database_name,opr:neq,value:examples))) 
HTTP/1.1" 200 823 "http://localhost:8088/superset/sqllab/"; "Mozilla/5.0 (X11; 
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 
Safari/537.36"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:18 +0000] "GET 
/api/v1/database/?q=(filters:!((col:allow_file_upload,opr:upload_is_enabled,value:!t)))
 HTTP/1.1" 200 521 "http://localhost:8088/superset/sqllab/"; "Mozilla/5.0 (X11; 
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 
Safari/537.36"
   superset_app            | Unable to load SQLAlchemy dialect <class 
'ibm_db_sa.pyodbc.AS400Dialect_pyodbc'>: No module named 
'sqlalchemy.connectors.zxJDBC'
   superset_app            | 2023-05-12 
13:01:20,807:WARNING:superset.db_engine_specs:Unable to load SQLAlchemy dialect 
<class 'ibm_db_sa.pyodbc.AS400Dialect_pyodbc'>: No module named 
'sqlalchemy.connectors.zxJDBC'
   superset_app            | Unable to load SQLAlchemy dialect <class 
'ibm_db_sa.pyodbc.AS400Dialect_pyodbc'>: No module named 
'sqlalchemy.connectors.zxJDBC'
   superset_app            | 2023-05-12 
13:01:20,809:WARNING:superset.db_engine_specs:Unable to load SQLAlchemy dialect 
<class 'ibm_db_sa.pyodbc.AS400Dialect_pyodbc'>: No module named 
'sqlalchemy.connectors.zxJDBC'
   superset_app            | Unable to load SQLAlchemy dialect <class 
'ibm_db_sa.pyodbc.AS400Dialect_pyodbc'>: No module named 
'sqlalchemy.connectors.zxJDBC'
   superset_app            | 2023-05-12 
13:01:20,815:WARNING:superset.db_engine_specs:Unable to load SQLAlchemy dialect 
<class 'ibm_db_sa.pyodbc.AS400Dialect_pyodbc'>: No module named 
'sqlalchemy.connectors.zxJDBC'
   superset_app            | Unable to load SQLAlchemy dialect <class 
'ibm_db_sa.pyodbc.AS400Dialect_pyodbc'>: No module named 
'sqlalchemy.connectors.zxJDBC'
   superset_app            | 2023-05-12 
13:01:20,817:WARNING:superset.db_engine_specs:Unable to load SQLAlchemy dialect 
<class 'ibm_db_sa.pyodbc.AS400Dialect_pyodbc'>: No module named 
'sqlalchemy.connectors.zxJDBC'
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:20 +0000] "GET 
/dataset/add/ HTTP/1.1" 200 49820 "http://localhost:8088/superset/sqllab/"; 
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/113.0.0.0 Safari/537.36"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:21 +0000] "GET 
/api/v1/database/?q=(filters:!((col:allow_file_upload,opr:upload_is_enabled,value:!t)))
 HTTP/1.1" 200 521 "http://localhost:8088/dataset/add/"; "Mozilla/5.0 (X11; 
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 
Safari/537.36"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:21 +0000] "GET 
/api/v1/database/?q=(filters:!((col:database_name,opr:neq,value:examples))) 
HTTP/1.1" 200 824 "http://localhost:8088/dataset/add/"; "Mozilla/5.0 (X11; Linux 
x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:21 +0000] "GET 
/api/v1/database/?q=(filters:!((col:database_name,opr:ct,value:%27%27)),order_columns:database_name,order_direction:asc,page:0,page_size:100)
 HTTP/1.1" 200 960 "http://localhost:8088/dataset/add/"; "Mozilla/5.0 (X11; 
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 
Safari/537.36"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:22 +0000] "POST 
/superset/log/?explode=events HTTP/1.1" 200 1 
"http://localhost:8088/dataset/add/"; "Mozilla/5.0 (X11; Linux x86_64) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:28 +0000] "GET 
/api/v1/database/3/schemas/?q=(force:!f) HTTP/1.1" 200 345 
"http://localhost:8088/dataset/add/"; "Mozilla/5.0 (X11; Linux x86_64) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
   superset_app            | 127.0.0.1 - - [12/May/2023:13:01:34 +0000] "GET 
/health HTTP/1.1" 200 2 "-" "curl/7.74.0"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:39 +0000] "GET 
/api/v1/dataset/?q=(filters:!((col:database,opr:rel_o_m,value:3),(col:schema,opr:eq,value:db2inst8),(col:sql,opr:dataset_is_null_or_empty,value:!t)),page:0)
 HTTP/1.1" 200 438 "http://localhost:8088/dataset/add/"; "Mozilla/5.0 (X11; 
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 
Safari/537.36"
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:39 +0000] "GET 
/api/v1/database/3/tables/?q=(force:!f,schema_name:db2inst8) HTTP/1.1" 200 406 
"http://localhost:8088/dataset/add/"; "Mozilla/5.0 (X11; Linux x86_64) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
   superset_app            | 2023-05-12 
13:01:46,631:ERROR:flask_appbuilder.api:Object of type LegacyRow is not JSON 
serializable
   superset_app            | Traceback (most recent call last):
   superset_app            |   File 
"/usr/local/lib/python3.9/site-packages/flask_appbuilder/api/__init__.py", line 
110, in wraps
   superset_app            |     return f(self, *args, **kwargs)
   superset_app            |   File "/app/superset/views/base_api.py", line 
127, in wraps
   superset_app            |     raise ex
   superset_app            |   File "/app/superset/views/base_api.py", line 
121, in wraps
   superset_app            |     duration, response = time_function(f, self, 
*args, **kwargs)
   superset_app            |   File "/app/superset/utils/core.py", line 1596, 
in time_function
   superset_app            |     response = func(*args, **kwargs)
   superset_app            |   File "/app/superset/utils/log.py", line 266, in 
wrapper
   superset_app            |     value = f(*args, **kwargs)
   superset_app            |   File "/app/superset/databases/api.py", line 697, 
in table_metadata
   superset_app            |     return self.response(200, **table_info)
   superset_app            |   File 
"/usr/local/lib/python3.9/site-packages/flask_appbuilder/api/__init__.py", line 
769, in response
   superset_app            |     _ret_json = jsonify(kwargs)
   superset_app            |   File 
"/usr/local/lib/python3.9/site-packages/flask/json/__init__.py", line 302, in 
jsonify
   superset_app            |     f"{dumps(data, indent=indent, 
separators=separators)}\n",
   superset_app            |   File 
"/usr/local/lib/python3.9/site-packages/flask/json/__init__.py", line 132, in 
dumps
   superset_app            |     return _json.dumps(obj, **kwargs)
   superset_app            |   File 
"/usr/local/lib/python3.9/json/__init__.py", line 234, in dumps
   superset_app            |     return cls(
   superset_app            |   File "/usr/local/lib/python3.9/json/encoder.py", 
line 199, in encode
   superset_app            |     chunks = self.iterencode(o, _one_shot=True)
   superset_app            |   File "/usr/local/lib/python3.9/json/encoder.py", 
line 257, in iterencode
   superset_app            |     return _iterencode(o, 0)
   superset_app            |   File 
"/usr/local/lib/python3.9/site-packages/flask/json/__init__.py", line 51, in 
default
   superset_app            |     return super().default(o)
   superset_app            |   File "/usr/local/lib/python3.9/json/encoder.py", 
line 179, in default
   superset_app            |     raise TypeError(f'Object of type 
{o.__class__.__name__} '
   superset_app            | TypeError: Object of type LegacyRow is not JSON 
serializable
   superset_app            | 172.21.0.1 - - [12/May/2023:13:01:46 +0000] "GET 
/api/v1/database/3/table/keyword/db2inst8/ HTTP/1.1" 500 26 
"http://localhost:8088/dataset/add/"; "Mozilla/5.0 (X11; Linux x86_64) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
   superset_worker_beat    | [2023-05-12 13:02:00,058: INFO/MainProcess] 
Scheduler: Sending due task reports.scheduler (reports.scheduler)
   superset_worker         | [2023-05-12 13:02:00,062: INFO/MainProcess] Task 
reports.scheduler[3a7bccb4-7ac1-49b1-bba0-3ccb74264030] received
   superset_worker         | [2023-05-12 13:02:00,098: INFO/ForkPoolWorker-31] 
Task reports.scheduler[3a7bccb4-7ac1-49b1-bba0-3ccb74264030] succeeded in 
0.03370582999923499s: None
   superset_app            | 127.0.0.1 - - [12/May/2023:13:02:04 +0000] "GET 
/health HTTP/1.1" 200 2 "-" "curl/7.74.0"
   
   
   
   
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: Version 113.0.5672.63 (Official Build) snap 
(64-bit)
   - superset version: `superset version` (the currently available 
docker-compose version)
   - python version: `python --version` (as per currently available 
docker-compose v3.9)
   - node.js version: `node -v` (as per currently available docker-compose)
   - any feature flags active: ( as per defaults in the docker-compose build)
   - (host) ubuntu linux 20.04 LTS x64 with latest fixes.
   - (host)docker desktop for linux version is 23.0.6
   - (host)git version 2.17.1
   - (host) locally installed (on host) IBM-DB2-LUW v11.5.8.0.
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [ ] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [ ] I have reproduced the issue with at least the latest released version 
of superset. (latest docker-compose build that is downloadable)
   - [ ] I have checked the issue tracker for the same issue and I haven't 
found one similar. (did not find one specific to IBM-DB2 that mentions 
LegacyRow is not JSON serializable
   
   ### Additional context
   
   I am able to use the SQL-LAB in superset to send queries to the Db2 database 
and get results, so it partially works, but not able to use the gui as intended 
to select tables etc.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to