Incubator-superset: When connecting to the oracle database, an error is reported when making a line chart

Created on 24 Jun 2019  路  13Comments  路  Source: apache/incubator-superset

ERROR:root:__init__() missing 1 required positional argument: 'col'

Traceback (most recent call last):
  File "G:\pyProduct\ss\superset\viz.py", line 407, in get_df_payload
    df = self.get_df(query_obj)
  File "G:\pyProduct\ss\superset\viz.py", line 194, in get_df
    self.results = self.datasource.query(query_obj)
  File "G:\pyProduct\ss\superset\connectors\sqla\models.py", line 834, in query
    query_str_ext = self.get_query_str_extended(query_obj)
  File "G:\pyProduct\ss\superset\connectors\sqla\models.py", line 481, in get_query_str_extended
    sql = self.database.compile_sqla_query(sqlaq.sqla_query)
  File "G:\pyProduct\ss\superset\models\core.py", line 901, in compile_sqla_query
    compile_kwargs={'literal_binds': True},
  File "<string>", line 1, in <lambda>
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\elements.py", line 462, in compile
    return self._compiler(dialect, bind=bind, **kw)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\elements.py", line 468, in _compiler
    return dialect.statement_compiler(dialect, self, **kw)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\dialects\oracle\base.py", line 685, in __init__
    super(OracleCompiler, self).__init__(*args, **kwargs)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\compiler.py", line 562, in __init__
    Compiled.__init__(self, dialect, statement, **kwargs)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\compiler.py", line 319, in __init__
    self.string = self.process(self.statement, **compile_kwargs)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\compiler.py", line 350, in process
    return obj._compiler_dispatch(self, **kwargs)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\visitors.py", line 91, in _compiler_dispatch
    return meth(self, **kw)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\dialects\oracle\base.py", line 875, in visit_select
    limitselect = sql.select([c for c in select.c])
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\util\langhelpers.py", line 855, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\selectable.py", line 616, in columns
    self._populate_column_collection()
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\selectable.py", line 3680, in _populate_column_collection
    c._make_proxy(self, key=key, name=name, name_is_truncatable=True)
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\elements.py", line 3780, in _make_proxy
    selectable, name=name if name else self.name
  File "G:\pyProduct\ss\env\lib\site-packages\sqlalchemy\sql\elements.py", line 4046, in _make_proxy
    is_literal=is_literal,
TypeError: __init__() missing 1 required positional argument: 'col'
#bug

Most helpful comment

@devilzhangzzz please check PR #7767

All 13 comments

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

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

Please provide Superset version info along with results from pip list

superset version:

release--0.33

pip list:

requirements.txt

alembic==1.0.0            # via flask-migrate
amqp==2.3.2               # via kombu
apispec[yaml]==1.2.0      # via flask-appbuilder
asn1crypto==0.24.0        # via cryptography
attrs==19.1.0             # via jsonschema
babel==2.6.0              # via flask-babel
billiard==3.5.0.4         # via celery
bleach==3.0.2
celery==4.2.0
certifi==2018.8.24        # via requests
cffi==1.11.5              # via cryptography
chardet==3.0.4            # via requests
click==6.7
colorama==0.3.9
contextlib2==0.5.5
croniter==0.3.29
cryptography==2.4.2
decorator==4.3.0          # via retry
defusedxml==0.5.0         # via python3-openid
flask-appbuilder==2.1.4
flask-babel==0.11.1       # via flask-appbuilder
flask-caching==1.4.0
flask-compress==1.4.0
flask-jwt-extended==3.18.1  # via flask-appbuilder
flask-login==0.4.1        # via flask-appbuilder
flask-migrate==2.1.1
flask-openid==1.2.5       # via flask-appbuilder
flask-sqlalchemy==2.4.0   # via flask-appbuilder, flask-migrate
flask-talisman==0.6.0
flask-wtf==0.14.2
flask==1.0.2
geopy==1.11.0
gunicorn==19.8.0
humanize==0.5.1
idna==2.6
isodate==0.6.0
itsdangerous==0.24        # via flask
jinja2==2.10.1            # via flask, flask-babel
jsonschema==3.0.1         # via flask-appbuilder
kombu==4.2.1              # via celery
mako==1.0.7               # via alembic
markdown==3.0
markupsafe==1.0           # via jinja2, mako
marshmallow-enum==1.4.1   # via flask-appbuilder
marshmallow-sqlalchemy==0.16.2  # via flask-appbuilder
marshmallow==2.19.2       # via flask-appbuilder, marshmallow-enum, marshmallow-sqlalchemy
numpy==1.15.2             # via pandas
pandas==0.23.4
parsedatetime==2.0.0
pathlib2==2.3.0
polyline==1.3.2
prison==0.1.0             # via flask-appbuilder
py==1.7.0                 # via retry
pycparser==2.19           # via cffi
pydruid==0.5.3
pyjwt==1.7.1              # via flask-appbuilder, flask-jwt-extended
pyrsistent==0.14.11       # via jsonschema
python-dateutil==2.6.1
python-dotenv==0.10.1
python-editor==1.0.3      # via alembic
python-geohash==0.8.5
python3-openid==3.1.0     # via flask-openid
pytz==2018.5              # via babel, celery, pandas
pyyaml==5.1
requests==2.22.0
retry==0.9.2
selenium==3.141.0
simplejson==3.15.0
six==1.11.0               # via bleach, cryptography, flask-jwt-extended, flask-talisman, isodate, jsonschema, pathlib2, polyline, prison, pydruid, pyrsistent, python-dateutil, sqlalchemy-utils, wtforms-json
sqlalchemy-utils==0.33.11
sqlalchemy==1.3.1
sqlparse==0.2.4
urllib3==1.24.3           # via requests, selenium
vine==1.1.4               # via amqp
webencodings==0.5.1       # via bleach
werkzeug==0.14.1          # via flask, flask-jwt-extended
wtforms-json==0.3.3
wtforms==2.2.1            # via flask-wtf, wtforms-json

requirements-dev.txt

coverage==4.5.3
flake8-commas==2.0.0
flake8-import-order==0.18.1
flake8-mypy==17.8.0
flake8-quotes==2.0.1
flake8==3.7.7
flask-cors==3.0.7
ipdb==0.12
mypy==0.670
mysqlclient==1.4.2.post1
nose==1.3.7
pip-tools==3.7.0
psycopg2-binary==2.7.5
pycodestyle==2.5.0
pyhive==0.6.1
pylint==1.9.2
python-dotenv==0.10.1
redis==2.10.6
statsd==3.3.0
thrift==0.11.0
tox==3.11.1

cx_Oracle version is 7.1.3

Please see if upgrading to sqlalchemy==1.3.5 helps, there was a bug in the earlier versions that caused trouble when using Oracle with Superset.

I have upgraded sqlalchemy to 1.3.5, but still can't.
https://github.com/apache/incubator-superset/issues/7765#issuecomment-505069025

I was able to reproduce, will investigate shortly.

thank you very much @villebro

@devilzhangzzz please check PR #7767

The test has passed, thank you again @villebro

What is the 'SQLAlchemy URI' that we should give when adding a new oracle database? Specifying the below string with valid values isn't working out

engine = create_engine('oracle://scott:[email protected]:1521/service_name')

I am struggling to form the uri string for oracle. Kindly suggest.

Thanks.

I think service_name should be equal to the TNS name. This is how the URI on my dev rig looks like (running Oracle locally on docker):

oracle+cx_oracle://system:XXXXXXXXXX@localhost:49161/?service_name=xe

Thanks. This uri worked after installing oracle instant client on the server.

Was this page helpful?
0 / 5 - 0 ratings