Connection Tool - Programmatically Remove Unused Datasource Connections, and List All Connections
Managing connections within your Sisense environment can become complex over time, if there are a large number of connections, and connections are often added, and replace earlier datasource connections. In some scenarios unused connections can accumulate, potentially cluttering the connection manager UI with no longer relevant connections. Although unused connections typically represent minimal direct security risk, it's considered best practice to maintain a clean, organized list of connections, and in some scenarios it can be desired to remove all unused connections. Sisense prevents the deletion of connections actively used in datasources, safeguarding your dashboards and datasources from disruptions. However, inactive or "orphaned" connections remain after datasources are deleted or a connection is replaced, potentially contributing to unnecessary UI complexity in the connection manager UI. Connections can be of any type Sisense supports, common types include various SQL connections, Excel files, and CSV files, as well as many data providers, such as Big Panda. This tool can also be used to list all connections, with no automatic deletion of unused connections.422Views4likes3CommentsThe Ability To Manage JDBC Connections
Question How to change the connection strings in an easy way? Answer Using the REST API you can update the data connection strings directly. Returns a list of all your connections: GET http://localhost:8081/api/v1/connection Updates a connection: PATCH http://localhost:8081/api/v1/connection/{id}682Views0likes0CommentsQuerying the Sisense Elasticube with Python
This article will cover two methods you can use to connect Python to the Elasticube. Method 1: Using ODBC Method 2: Using the REST API Method 1: Connect to the EC with ODBC Download Sisense ODBC This method will require you to download the ODBC driver. Follow the instructions on the ODBC documentation page before starting to work in Python. Connect to the system DSN ODBC with pyODBC The following libraries are required for this step (both are standard with anaconda) pyodbc pandas Step 1: Import libraries import pyodbc import pandas as pd Step 2: Establish a connection to the EC cnxn = pyodbc.connect('DSN=Sisense ODBC Driver') Step 3: (optional) Print out available tables # Create a cursor that can execute commands against the connection cursor = cnxn.cursor() # Print all available tables for t in cursor.tables(): print(t[2]) Step 4: Put the data into a dataframe Substitute <Table Name> with the table you want to query # Bring the data into a dataframe called df df = pd.read_sql('select * from <Table Name>', cnxn) # Print out the top records from df df.head() Method 2: Query the EC with the REST API This method will require the following python libraries: requests urllib.parse pandas Step 1: Import the libraries import requests import urllib.parse as parse import pandas as pd Step 2: Define the datasource and your query # Your elasticube name is your dataSource dataSource = 'leapYearUseCase' # Query the data as if you were writing a custom SQL query query = 'select Years, min(Amount) as maxAmount from <Your Table> group by Years' Step 3: Parse the queries dataSourceURI = parse.quote(dataSource) queryRUI = parse.quote(query) Step 4: Establish your connection To retrieve your Bearer token follow instructions under USING THE SISENSE API - Authentication # http://localhost:8081 may vary depending on your configuration # The request asks for the data formatted as a csv for convenience endPoint = 'http://localhost:8081/api/elasticubes/{}/Sql?format=json&query={}'.format(dataSourceURI, queryRUI) # Enter your bearer token in place of <your bearer token> header = {'Authorization': 'Bearer <your bearer token>'} Step 5: Post and Get the Response # Post to get the response response = requests.get(endPoint, headers=header) # Collect the response text formatted as a JSON data = response.json() # Put the data into a dataframe df = pd.DataFrame(data['values'], columns=data['headers']) Cheers!1.8KViews0likes1CommentHow to delete connections from Quick Access
To remove the connection from the Quick Access, please, use REST API. You need to do the following. For Windows: 1. Go to Admin - REST API - 1.0 2. Use 1.0 GET /users specifying username/first name/last name to get the _id parameter of the user 3. Use 1.0 GET /connection or , locate the connection with owner = _id from step 2 and provider = "MySQL" to get the _id of the connection for the specific user. 4. Use 1.0 DELETE /connection/{id} using the connection _id from step 3 to delete the connection so it will not be displayed in the quick access. For Linux: 1. Go to Admin - REST API - 1.0 2. Use 1.0 GET /users specifying username/first name/last name to get the _id parameter of the user 3. Use 1.0 GET /connection or , locate the connection with owner = _id from step 2 and provider = "MySQL" to get the oid of the connection for the specific user. 4. Use 1.0 DELETE /connection/{id} using the connection oid from step 3 to delete the connection so it will not be displayed in the quick access.858Views0likes0Comments