This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select dt_Date, pressure,pressure_no, | |
| case | |
| when pressure_no = 0 then 'No pressure, you can lower' | |
| when pressure_no <=25 then 'Small amount of pressure - try lowering' | |
| when pressure_no <=50 then 'Some amount of pressure - consider lowering' | |
| when pressure_no <=75 then 'A lot of pressure' | |
| else 'Mostly under pressure' | |
| end rr | |
| from ( | |
| select t.dt_Date, case t._under_pressure when 0 then 'No pressure' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE @days INT = 30; | |
| DECLARE @timeout_s INT = 600; | |
| DECLARE @tolerance_s INT = 30; | |
| SELECT | |
| CONVERT(DATE, submit_time) AS day_utc, | |
| COUNT(*) AS client_timeout_cancels, | |
| COUNT(DISTINCT query_hash) AS distinct_statements, | |
| SUM(allocated_cpu_time_ms) AS wasted_cpu_ms, | |
| CAST(SUM(allocated_cpu_time_ms) / 3600000.0 AS DECIMAL(18, 2)) AS wasted_cpu_hours |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE @days INT = 30; | |
| DECLARE @timeout_s INT = 600; | |
| DECLARE @tolerance_s INT = 30; | |
| WITH timeouts AS ( | |
| SELECT | |
| query_hash, | |
| ISNULL(program_name, '(none supplied)') AS program_name, | |
| login_name, | |
| statement_type, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH cancels AS ( | |
| SELECT | |
| ISNULL(program_name, '(none supplied)') AS program_name, | |
| error_code, | |
| allocated_cpu_time_ms, | |
| DATEDIFF(SECOND, submit_time, end_time) AS client_elapsed_s | |
| FROM queryinsights.exec_requests_history | |
| WHERE submit_time >= DATEADD(DAY, -30, GETUTCDATE()) | |
| AND UPPER(status) LIKE 'CANCEL%' -- 'Canceled', one L. See header. | |
| --AND end_time IS NOT NULL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| ISNULL(program_name, '(none supplied)') AS program_name, | |
| status, | |
| error_code, | |
| CASE | |
| WHEN error_code = 3617 THEN 'client sent abort signal (cancel or client-side timeout)' | |
| WHEN error_code = 0 THEN 'no error recorded' | |
| ELSE error_code | |
| END AS error_meaning, | |
| COUNT(*) AS queries, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR ALTER PROCEDURE dbo.usp_DropSchema | |
| @SchemaName sysname, | |
| @DropSchema bit = 1, | |
| @WhatIf bit = 0, | |
| @Print bit = 1, | |
| @MaxPasses int = 10 | |
| AS | |
| BEGIN |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import notebookutils | |
| import sempy.fabric as fabric | |
| workspace_id=spark.conf.get("trident.workspace.id") | |
| lakehouse_id=spark.conf.get("trident.lakehouse.id") | |
| #Instantiate the client | |
| client = fabric.FabricRestClient() | |
| sqlendpoint = fabric.FabricRestClient().get(f"/v1/workspaces/{workspace_id}/lakehouses/{lakehouse_id}").json()['properties']['sqlEndpointProperties']['id'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import struct | |
| import pyodbc | |
| import pandas as pd | |
| from azure.identity import ClientSecretCredential | |
| import jwt | |
| tenant_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | |
| client_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | |
| client_secret = "Nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" |
NewerOlder