ibmdb / python-ibmdbsa

Automatically exported from code.google.com/p/ibm-db.ibm-db-sa
Apache License 2.0
40 stars 59 forks source link

TypeError: DBAPITypeObject(['INT', 'INTEGER', 'SMALLINT']) is not JSON serializable #101

Closed HenryBeWell closed 1 year ago

HenryBeWell commented 3 years ago

env:

traceback

Traceback (most recent call last):
  File "/opt/software/mytemp/hue-release-4.9.0/desktop/libs/notebook/src/notebook/decorators.py", line 114, in wrapper
    return f(*args, **kwargs)
  File "/opt/software/mytemp/hue-release-4.9.0/desktop/libs/notebook/src/notebook/api.py", line 235, in execute
    response = _execute_notebook(request, notebook, snippet)
  File "/opt/software/mytemp/hue-release-4.9.0/desktop/libs/notebook/src/notebook/api.py", line 196, in _execute_notebook
    history.update_data(notebook)
  File "/opt/software/mytemp/hue-release-4.9.0/desktop/core/src/desktop/models.py", line 1245, in update_data
    self.data = json.dumps(data_dict)
  File "/usr/lib64/python2.7/json/__init__.py", line 243, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib64/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: DBAPITypeObject(['INT', 'INTEGER', 'SMALLINT']) is not JSON serializable

query : SELECT * FROM catalog engine is "db2+ibm_db://user:pwd@host:port/db" any help? thanks!

amukherjee28 commented 3 years ago

Can we please provide an example through sample code, so that we can understand a bit more on what exactly you are trying here.

HenryBeWell commented 3 years ago

hi@amukherjee28 , first of all ,thank you for your reply. question is I want to integrate db2 into hue ini

[[[db2]]]
    name = DB2
    interface=sqlalchemy
    options='{"url": "db2+ibm_db://user:pwd@host:port/db"}'

image

amukherjee28 commented 3 years ago

Hi @HenryBeWell

Thank you providing some insight on this.

If I understand correctly, you are trying to connect to a DB2 database through hue using the sqlalchemy driver.

I will check on this and come back with more details on the support.

Thanks.

bchoudhary6415 commented 1 year ago

Hello @HenryBeWell Please use latest version of ibm_db, ibm_db_sa and python and verify the issue. Thank you

bchoudhary6415 commented 1 year ago

Since No response from the user, I'm closing the issue. If the user encounters any further errors, they are welcome to reopen the issue.