cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error while installing SAT tool in azure databricks

p-kolluri
New Contributor II

Hi, was running the security analysis initializer notebook, am I'm getting an error in cmd 8 for import_dashboard_template notebook. That is notebook no.5. First got an error for cmd 8  for this line "workspacedf = spark.sql("select * from `global_temp`.`all_workspaces` where workspace_id='" + current_workspace + "'" )" . After changing the line to "workspacedf = dfexist.filter(dfexist['workspace_id'] == current_workspace)" the cell worked fine. But now getting an error in cmd 9 for this line "
if resource['endpoint_id'] == json_['sql_warehouse_id']:. "as string indices must be integers". Can someone help me with this. Thank you.

@arun_pamulapati 

2 REPLIES 2

 Also here is the whole code 

import requests
DOMAIN = ws.deployment_url
TOKEN =  dbutils.secrets.get(json_['workspace_pat_scope'], ws.ws_token)
print(json_['workspace_pat_scope'])
loggr.info(f"Looking for data_source_id for : {json_['sql_warehouse_id']}!")
response = requests.get(
          'https://%s/api/2.0/preview/sql/data_sources' % (DOMAIN),
          headers={'Authorization': 'Bearer %s' % TOKEN},
          json=None,
          timeout=60
        )

print(response)
resources = json.loads(response.text)

found = False
for resource in resources:
    if resource['endpoint_id'] == json_['sql_warehouse_id']:
        data_source_id = resource['id']
        loggr.info(f"Found data_source_id for : {json_['sql_warehouse_id']}!")
        found = True
        break
           
if (found == False😞
    dbutils.notebook.exit("The configured SQL Warehouse Endpoint is not found.")
 
And when trying to run this code 
import requests
DOMAIN = ws.deployment_url
TOKEN =  dbutils.secrets.get(json_['workspace_pat_scope'], ws.ws_token)
print(json_['workspace_pat_scope'])
loggr.info(f"Looking for data_source_id for : {json_['sql_warehouse_id']}!")
response = requests.get(
          'https://%s/api/2.0/preview/sql/data_sources' % (DOMAIN),
          headers={'Authorization': 'Bearer %s' % TOKEN},
          json=None,
          timeout=60
        )

print(response)
Getting a 403 error. That might be the problem. The token and api pair work ok when we tried to get a response in CLI not sure why its not working in databricks.
 

victormarcel09
New Contributor II

Hii,

You can double-check the structure and contents of the json_ object to ensure it contains the expected keys and values. If you still encounter issues, verify the data types and perform necessary type conversions to ensure compatibility.

Best regard,
Follow My Health

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