Skip to content

Instantly share code, notes, and snippets.

View UstDoesTech's full-sized avatar
🏠
Working from home

Ust Oldfield UstDoesTech

🏠
Working from home
View GitHub Profile
# Databricks notebook source
import requests
import json
# COMMAND ----------
dbutils.widgets.text("workspaceUrl", "https://adb-123456789101112.13.azuredatabricks.net" ,"Workspace URL")
dbutils.widgets.text("clusterActivity", "start" ,"Cluster Activity")
dbutils.widgets.text("clusterId", "444abcdefgh666" ,"Cluster ID")
# Databricks notebook source
import requests
import json
# COMMAND ----------
dbutils.widgets.text("workspaceUrl", "https://adb-123456789101112.13.azuredatabricks.net" ,"Workspace URL")
dbutils.widgets.text("clusterActivity", "start" ,"Cluster Activity")
dbutils.widgets.text("clusterId", "4444-666666-abcdefgh" ,"Cluster ID")
CREATE PROCEDURE Operation.CreateDeltaView
(
@QualifiedName NVARCHAR(300),
@Location NVARCHAR(200)
)
AS
DECLARE @DropStatement NVARCHAR(MAX) = 'DROP VIEW IF EXISTS '+ @QualifiedName +';'
PRINT (@DropStatement)
EXEC sp_executesql @DropStatement
CREATE PROCEDURE Operation.CreateSchema
(
@SchemaName NVARCHAR(300)
)
AS
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = @SchemaName)
DECLARE @CreateStatement NVARCHAR(MAX) = 'CREATE SCHEMA ' + @SchemaName
PRINT (@CreateStatement)
EXEC sp_executesql @CreateStatement
CREATE SCHEMA Operation;
CREATE MASTER KEY ENCRYPTION
BY PASSWORD = '<Secure String>';
CREATE DATABASE SCOPED CREDENTIAL [SqlCredsMI]
WITH IDENTITY='Managed Identity';
CREATE EXTERNAL DATA SOURCE DataLakeMI WITH (
LOCATION = 'https://datalakename.dfs.core.windows.net'
, CREDENTIAL = SqlCredsMI
);
IF NOT EXISTS(SELECT * FROM sys.databases WHERE name = 'ServerlessSQL')
CREATE DATABASE ServerlessSQL
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"synapseWorkspace": {
"value": {
"Name": "synapseworkspacename",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"resourceGroup": "resourcegroupname",
"properties": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"synapseWorkspace": {
"type": "object"
},
"defaultADLSStorageAccount": {
"type": "object"
},
parameters:
group: variable-group
azureResourceManagerConnection: 'Service_Connection_Name'
deploymentName: stage_deployment
displayName: SynapseDeployment
environment: Development
jobs:
- deployment: ${{ parameters.deploymentName }}