Comments (16)
...actually updating to 2.1.0 helped solving my issue! The error message changed from:
databricks.sql.thrift_backend: Error during request to server: {...}
to:
databricks.sql.thrift_backend: Error during request to server: : Invalid access token. {...}
So my databricks access token has been expired. After adding a new token to my script everything is running again 👍
from databricks-sql-python.
dears,
is there any solution to fix this issue?
from databricks-sql-python.
As yet I'm not able to reproduce this behaviour in the connector. Even with this specified version of Python. My best recommendation is to try with a fresh installation of Python within a virtual environment.
from databricks-sql-python.
I see the same behavior since a few weeks. Before that, everything was fine and a connection could be established. Nothing changed in the code / the SQL endpoint (at least not from my side). Just updated databricks-sql-connector to 2.1.0 but the result is the same.
from databricks-sql-python.
I'm closing this issue out due to its age. Feel free to reopen or make a new issue if a similar issue arrises.
from databricks-sql-python.
The issue still exists. I had success with an initial access token, but I am getting RequestError: Error during request to server: : Invalid access token. when I used a new token and revoked the old one.
from databricks-sql-python.
@chozillla Can you provide reproduction steps?
from databricks-sql-python.
Interestingly, it works fine when I explicitly put in the values. This is on a jupyter notebook on vscode via Anaconda.
from databricks-sql-python.
Uh, so I just exited vscode and restarted and it worked. Strange issue.
from databricks-sql-python.
I'm experiencing the same problem, but in my case, it only occurs when I increase the number of rows that will be written to the Databricks table (50 rows).
from databricks-sql-python.
Hi Everyone,
Is there any fix for above issue? I tried everything mentioned above.
main(server_hostname = args.server_hostname, http_path = args.http_path, schema = args.schema, access_token = args.access_token)
File "extract.py", line 24, in main
dbx_extractor.execute_sql(sql_query, server_hostname, http_path, access_token)
File "/mnt/azureml/cr/j/2c91464c9e0743f5860e8f48b407683d/exe/wd/dbextractor.py", line 23, in execute_sql
with db_sql.connect(
File "/azureml-envs/azureml_9806bfc7c716eaf0df12bea8512e961b/lib/python3.8/site-packages/databricks/sql/init.py", line 50, in connect
return Connection(server_hostname, http_path, access_token, **kwargs)
File "/azureml-envs/azureml_9806bfc7c716eaf0df12bea8512e961b/lib/python3.8/site-packages/databricks/sql/client.py", line 189, in init
self._session_handle = self.thrift_backend.open_session(
File "/azureml-envs/azureml_9806bfc7c716eaf0df12bea8512e961b/lib/python3.8/site-packages/databricks/sql/thrift_backend.py", line 464, in open_session
response = self.make_request(self._client.OpenSession, open_session_req)
File "/azureml-envs/azureml_9806bfc7c716eaf0df12bea8512e961b/lib/python3.8/site-packages/databricks/sql/thrift_backend.py", line 393, in make_request
self._handle_request_error(error_info, attempt, elapsed)
File "/azureml-envs/azureml_9806bfc7c716eaf0df12bea8512e961b/lib/python3.8/site-packages/databricks/sql/thrift_backend.py", line 261, in _handle_request_error
raise network_request_error
databricks.sql.exc.RequestError: Error during request to server
from databricks-sql-python.
from databricks-sql-python.
Hello,
We are seeing the same error, here is the relevant exception text. We use polars (0.20.6) to make requests to our Databricks endpoint using sql.connect. This works fine for some time until it stops working. Then if we simply restart our pod (lives as a docker container in kubernetes), it starts working again.
def get_databricks_connection():
return sql.connect(
server_hostname=os.getenv("DATABRICKS_SERVER_HOSTNAME"),
http_path=os.getenv("DATABRICKS_HTTP_PATH"),
access_token=os.getenv("DATABRICKS_TOKEN"),
use_inline_params=True,
)
databricks_connection = get_databricks_connection()
pl.read_database(
query=QUERY,
connection=databricks_connection,
execute_options={
"parameters": {
"some_param": some_param,
}
},
)
certifi==2024.2.2
polars==0.20.6
databricks-sql-connector==3.0.3
thrift==0.16.0
pyarrow==14.0.2
flask==2.2.5
requests==2.28.2
urllib3==1.26.18
line 255, in _query_event\n return pl.read_database(\n File \"/home/python/.local/lib/python3.10/site-packages/polars/io/database.py\", line 582, in read_database\n return cx.execute(\n File \"/home/python/.local/lib/python3.10/site-packages/polars/io/database.py\", line 345, in execute\n result = cursor_execute(query, **options)\n File \"/home/python/.local/lib/python3.10/site-packages/databricks/sql/client.py\", line 761, in execute\n execute_response = self.thrift_backend.execute_command(\n File \"/home/python/.local/lib/python3.10/site-packages/databricks/sql/thrift_backend.py\", line 868, in execute_command\n resp = self.make_request(self._client.ExecuteStatement, req)\n File \"/home/python/.local/lib/python3.10/site-packages/databricks/sql/thrift_backend.py\", line 507, in make_request\n self._handle_request_error(error_info, attempt, elapsed)\n File \"/home/python/.local/lib/python3.10/site-packages/databricks/sql/thrift_backend.py\", line 337, in _handle_request_error\n raise network_request_error\ndatabricks.sql.exc.RequestError: Error during request to server"
from databricks-sql-python.
Hello, I'm seeing the same error.
Code:
from databricks import sql
import os
with sql.connect(
server_hostname="****************.cloud.databricks.com",
http_path="/sql/1.0/warehouses/****************",
access_token="****************",
) as connection:
cursor = connection.cursor()
cursor.execute("SELECT * from range(10)")
print(cursor.fetchall())
cursor.close()
connection.close()
Error:
with sql.connect(
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/databricks/sql/__init__.py", line 84, in connect
return Connection(server_hostname, http_path, access_token, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/databricks/sql/client.py", line 232, in __init__
self._open_session_resp = self.thrift_backend.open_session(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/databricks/sql/thrift_backend.py", line 578, in open_session
response = self.make_request(self._client.OpenSession, open_session_req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/databricks/sql/thrift_backend.py", line 507, in make_request
self._handle_request_error(error_info, attempt, elapsed)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/databricks/sql/thrift_backend.py", line 337, in _handle_request_error
raise network_request_error
databricks.sql.exc.RequestError: Error during request to server
from databricks-sql-python.
@susodapop Can you please reopen this issue? There are new reports for this issue since the issue was closed.
from databricks-sql-python.
I'm not able to reopen issues any longer. But I would encourage you to turn on DEBUG logging for your connector and share what you find. RequestError
is a very generic exception and could point to any number of issues. Without more detail it's impossible to say what the root cause is.
from databricks-sql-python.
Related Issues (20)
- [sqlalchemy] execute("select 1") gives TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' HOT 8
- `databricks.sql.connect` hangs in a long retrying loop when an invalid access token is used HOT 3
- Idea: arrow_record_batches cursor method
- SQLAlchemy engine from workspace level service principle? HOT 2
- Unable to write list/array type data HOT 2
- Issue with version 3.1.1
- Failure on cursor.fetchall() HOT 2
- Fixing a couple type problems. (adding py.typed, typing connect, returning Any from fetchall (which I failed to fix!)) HOT 2
- Connector reads 0 rows although Cluster returned results HOT 18
- support new Cursor attribute that provides information on completed commands HOT 1
- loosen, update, or widen pyarrow dependencies HOT 2
- ImportError: cannot import name 'sql' from partially initialized module 'databricks' HOT 2
- Unpin Thrift
- Original thrift file HOT 3
- Invalid SessionHandle Error
- PyCharm IDE + pandas exit code 139
- [Feature Request] Support async execution
- Bad token is being retried in `databricks.sql.connect`
- TypeError: Retry.__init__() got an unexpected keyword argument 'backoff_max' HOT 4
- Too large queries produce MaxRetryError HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from databricks-sql-python.