You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/07/16 18:49:01 UTC

[GitHub] [superset] edgui-appolonicorreia commented on issue #20371: Can't connect to Oracle DB

edgui-appolonicorreia commented on issue #20371:
URL: https://github.com/apache/superset/issues/20371#issuecomment-1186264176

   > I'm working through a similar problem now. Did you install the Oracle instant client into the Docker container or system you are running superset from? cx_oracle requires either the instant client or full Oracle client. The recently released `python-oracledb` no longer has this requirement, so installation should get easier in the near future.
   > 
   > I'm using the following in my Docker container to install the latest SQL client:
   > 
   > ```
   > RUN mkdir -p /usr/share/oracle/network/admin \
   >     && cd /usr/share/oracle \
   >     && apt-get update -y \
   >     && apt-get install -y --no-install-recommends git ca-certificates wget build-essential unzip curl libaio1 libaio-dev \
   >     && rm -rf /var/lib/apt/lists/* \
   >     && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
   >     && wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip \
   >     && unzip instantclient-basiclite-linuxx64.zip \
   >     && rm -f instantclient-basiclite-linuxx64.zip \
   >     && cd  /usr/share/oracle/instantclient* \
   >     && rm -f *jdbc* *occi* *mysql* *README *jar uidrvci genezi adrci \
   >     && echo  /usr/share/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf \
   >     && ldconfig \
   >     && echo 'local_xe=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xepdb1)))' > /usr/share/oracle/network/admin/tnsnames.ora```
   > ```
   
   I tried that approach, adding those lines at the Dockerfile and running `docker compose -f docker-compose-non-dev.yml up --build`, but I got a new error message (hahahahahahaahahaha) when I tried to connect to the DB:
   
   ```superset_app          | 172.21.0.1 - - [16/Jul/2022:17:48:22 +0000] "GET /api/v1/me/ HTTP/1.1" 200 150 "http://localhost:8088/databaseview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36"
   superset_app          | 127.0.0.1 - - [16/Jul/2022:17:48:23 +0000] "GET /health HTTP/1.1" 200 2 "-" "curl/7.74.0"
   superset_app          | CommandException
   superset_app          | Traceback (most recent call last):
   superset_app          |   File "/app/superset/databases/commands/test_connection.py", line 77, in run
   superset_app          |     engine = database.get_sqla_engine()
   superset_app          |   File "/app/superset/utils/memoized.py", line 50, in __call__
   superset_app          |     value = self.func(*args, **kwargs)
   superset_app          |   File "/app/superset/models/core.py", line 401, in get_sqla_engine
   superset_app          |     raise self.db_engine_spec.get_dbapi_mapped_exception(ex)
   superset_app          |   File "/app/superset/models/core.py", line 399, in get_sqla_engine
   superset_app          |     return create_engine(sqlalchemy_url, **params)
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/__init__.py", line 525, in create_engine
   superset_app          |     return strategy.create(*args, **kwargs)
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/strategies.py", line 61, in create
   superset_app          |     entrypoint = u._get_entrypoint()
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/url.py", line 172, in _get_entrypoint
   superset_app          |     cls = registry.load(name)
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 277, in load
   superset_app          |     raise exc.NoSuchModuleError(
   superset_app          | sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:cx_Oracle.oracle
   superset_app          | 
   superset_app          | The above exception was the direct cause of the following exception:
   superset_app          | 
   superset_app          | Traceback (most recent call last):
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
   superset_app          |     rv = self.dispatch_request()
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
   superset_app          |     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 89, in wraps
   superset_app          |     return f(self, *args, **kwargs)
   superset_app          |   File "/app/superset/views/base_api.py", line 113, in wraps
   superset_app          |     raise ex
   superset_app          |   File "/app/superset/views/base_api.py", line 110, in wraps
   superset_app          |     duration, response = time_function(f, self, *args, **kwargs)
   superset_app          |   File "/app/superset/utils/core.py", line 1533, in time_function
   superset_app          |     response = func(*args, **kwargs)
   superset_app          |   File "/app/superset/utils/log.py", line 244, in wrapper
   superset_app          |     value = f(*args, **kwargs)
   superset_app          |   File "/app/superset/views/base_api.py", line 83, in wraps
   superset_app          |     return f(self, *args, **kwargs)
   superset_app          |   File "/app/superset/databases/api.py", line 709, in test_connection
   superset_app          |     TestConnectionDatabaseCommand(item).run()
   superset_app          |   File "/app/superset/databases/commands/test_connection.py", line 124, in run
   superset_app          |     raise DatabaseTestConnectionDriverError(
   superset_app          | superset.databases.commands.exceptions.DatabaseTestConnectionDriverError: Could not load database driver: BaseEngineSpec
   superset_app          | 2022-07-16 17:48:25,194:WARNING:superset.views.base:CommandException
   superset_app          | Traceback (most recent call last):
   superset_app          |   File "/app/superset/databases/commands/test_connection.py", line 77, in run
   superset_app          |     engine = database.get_sqla_engine()
   superset_app          |   File "/app/superset/utils/memoized.py", line 50, in __call__
   superset_app          |     value = self.func(*args, **kwargs)
   superset_app          |   File "/app/superset/models/core.py", line 401, in get_sqla_engine
   superset_app          |     raise self.db_engine_spec.get_dbapi_mapped_exception(ex)
   superset_app          |   File "/app/superset/models/core.py", line 399, in get_sqla_engine
   superset_app          |     return create_engine(sqlalchemy_url, **params)
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/__init__.py", line 525, in create_engine
   superset_app          |     return strategy.create(*args, **kwargs)
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/strategies.py", line 61, in create
   superset_app          |     entrypoint = u._get_entrypoint()
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/url.py", line 172, in _get_entrypoint
   superset_app          |     cls = registry.load(name)
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 277, in load
   superset_app          |     raise exc.NoSuchModuleError(
   superset_app          | sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:cx_Oracle.oracle
   superset_app          | 
   superset_app          | The above exception was the direct cause of the following exception:
   superset_app          | 
   superset_app          | Traceback (most recent call last):
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
   superset_app          |     rv = self.dispatch_request()
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
   superset_app          |     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
   superset_app          |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 89, in wraps
   superset_app          |     return f(self, *args, **kwargs)
   superset_app          |   File "/app/superset/views/base_api.py", line 113, in wraps
   superset_app          |     raise ex
   superset_app          |   File "/app/superset/views/base_api.py", line 110, in wraps
   superset_app          |     duration, response = time_function(f, self, *args, **kwargs)
   superset_app          |   File "/app/superset/utils/core.py", line 1533, in time_function
   superset_app          |     response = func(*args, **kwargs)
   superset_app          |   File "/app/superset/utils/log.py", line 244, in wrapper
   superset_app          |     value = f(*args, **kwargs)
   superset_app          |   File "/app/superset/views/base_api.py", line 83, in wraps
   superset_app          |     return f(self, *args, **kwargs)
   superset_app          |   File "/app/superset/databases/api.py", line 709, in test_connection
   superset_app          |     TestConnectionDatabaseCommand(item).run()
   superset_app          |   File "/app/superset/databases/commands/test_connection.py", line 124, in run
   superset_app          |     raise DatabaseTestConnectionDriverError(
   superset_app          | superset.databases.commands.exceptions.DatabaseTestConnectionDriverError: Could not load database driver: BaseEngineSpec
   ```
   And I used this syntax string connection: ```cx_oracle+oracle://username:password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host_or_scan_address)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=db_service_name)))```
   
   Any guesses?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org