upstream request timeout in databricks apps when using databricks sql connector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 09:56 AM
Hi, i am building an application in Databricks apps, Sometimes when i try to fetch data using Databricks SQL connector in an API, it takes time to hit the SQL warehouse and if the time exceeds more than 60 seconds it gives upstream timeout error. I have monitored the queries once they reach the warehouse it gets executed in milliseconds. The time being taken is to send the query to warehouse for execution and to send back the data to the server. how can this be handled? also this happens only some times.
- Labels:
-
Spark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2025 01:47 PM
Hi @yathish,
When you submit the query to the warehouse, is the warehouse up and running already? and are you using classic, pro or serverless warehouse?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 10:49 AM
Hi @Alberto_Umana, yes the server is up and running. I am using serverless warehouse. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 10:53 AM
def credential_provider():
config = Config(
host=os.getenv('DATABRICKS_HOST'),
client_id=os.getenv("DATABRICKS_CLIENT_ID"),
client_secret=os.getenv("DATABRICKS_CLIENT_SECRET"))
return oauth_service_principal(config)
def db_connector():
connection = sql.connect(
server_hostname=os.getenv('DATABRICKS_HOST'),
http_path=os.getenv('WAREHOUSE_HTTP_PATH'),
credentials_provider=credential_provider)
return connection
and in the api i am using it as
with db_connector() as connection:
with connection.cursor() as cursor:
results = cursor.execute(query).fetchall()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 04:22 AM - edited 02-20-2025 04:39 AM
It is happening to us too! We have a model that call the sql connection and we are getting a lot of this error in the serving endpoint. We also use serveless.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 10:33 AM
@Alberto_Umana Can you please let us know if there are any updates on this?

