cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Connection Error Python databricks-sql-connector

JohnsonBDSouza
New Contributor II

Hello Databricks Community, I'm trying to connect to Databricks via the Python library (databricks-sql-connector-3.0.1). This below code was working few months ago. Now, it is failing to connect.

hostname, http_path and access_token are valid values and there is not connectivity issue from my machine to Databricks instance.

Any pointer will be of great help. Thanks.

>>> connection = sql.connect(server_hostname = hostname, http_path = http_path, access_token = token)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python\Python38\lib\site-packages\databricks\sql\__init__.py", line 51, in connect
return Connection(server_hostname, http_path, access_token, **kwargs)
File "C:\Python\Python38\lib\site-packages\databricks\sql\client.py", line 225, in __init__
self.thrift_backend = ThriftBackend(
File "C:\Python\Python38\lib\site-packages\databricks\sql\thrift_backend.py", line 209, in __init__
self.retry_policy = databricks.sql.auth.thrift_http_client.DatabricksRetryPolicy(
File "C:\Python\Python38\lib\site-packages\databricks\sql\auth\retry.py", line 131, in __init__
super().__init__(
TypeError: __init__() got an unexpected keyword argument 'allowed_methods'
>>>

3 REPLIES 3

Kaniz_Fatma
Community Manager
Community Manager

Hi @JohnsonBDSouza, In your case, it seems like the DatabricksRetryPolicy class is being initialized with an unexpected keyword argument allowed_methods. This could be due to a variety of reasons such as changes in the library version, deprecated features, or changes in the function signatures.

 

One possible solution could be to check the version of the databricks-sql-connector you’re using. If it had been updated recently, the function signatures might have changed, causing this error. You might want to look at the documentation or the source code of the library to see if there have been any changes to the DatabricksRetryPolicy class or the __init__ method.

 

Another possibility could be a mismatch between the versions of the libraries you’re using. If databricks-sql-connector depends on another library and you have a different version of that library installed, it could cause this error. You might want to check the dependencies of databricks-sql-connector and make sure you have the correct versions installed.

Thanks the pointers @Kaniz_Fatma 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 
 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group