Connecting to SQL Warehouse in Custom App

bferrell
New Contributor II

I've got a custom Dash app I've written and am attempting to deploy. It runs fine on my local machine (while accessing my DB SQL Warehouse), but when I try deploying to Databricks, it cannot connect to the data for some reason. I was basically following the guide in this video . Since he did not change his code in this video when he deployed, I assumed I didn't have to. Anyone else run into this issue? I've included a code snippet of my connection details - which again - run fine on local. 

from databricks import sdk, sql
cfg = sdk.config.Config()
with sql.connect(
    server_hostname = cfg.host,
    http_path = os.environ.get("HTTP_PATH"),
    credentials_provider = lambda: cfg.authenticate,
    ) as conn:
    with conn.cursor() as cursor:
        print("Executing SQL query...")
        cursor.execute(f'''
                        SELECT 
                            *
                            FROM {table_name}
                        ''')
        print("Query executed, fetching results...")