Skip to content

Instantly share code, notes, and snippets.

View 7effrey89's full-sized avatar

Jeffrey Lai 7effrey89

  • Microsoft
  • Denmark
View GitHub Profile
@7effrey89
7effrey89 / aml_fabric.py
Last active March 11, 2025 14:38
AML integration with Microsoft Fabric
# %%
!pip install mltable
# %%
# AML to query delta table in lakehouse to pandas dataframe
from mltable import from_delta_lake
#url = "https://onelake.dfs.fabric.microsoft.com/ws_ramboll_data/bronze.Lakehouse/Tables/taxidatacsv"
abfs = "abfss://[email protected]/bronze.Lakehouse/Tables/taxidatacsv"
df2 = from_delta_lake(abfs).to_pandas_dataframe()
@7effrey89
7effrey89 / Pipeline_Execute_Fabric_Pipeline.yaml
Last active March 21, 2025 10:24
Azure DevOps Pipeline to Execute Microsoft Fabric Pipeline using REST API
trigger:
branches:
include:
- main
variables:
pWorkspaceId: '<GUID OF FABRIC WORKSPACE>' #My Fabric Workspace ID
pPipelineId: '<GUID OF FABRIC PIPELINE IN WORKSPACE>' #My Fabric Pipeline ID
stages:
@7effrey89
7effrey89 / Pipeline_Execute_ADF_Pipeline.yaml
Last active March 21, 2025 10:24
Azure DevOps Pipeline to Execute Azure Data Factory Pipeline using REST API
trigger:
branches:
include:
- main
variables:
resourceGroupName: '<Name of Resource Group>' # My Resource Group Name
dataFactoryName: '<Name of ADF instance>' # My Data Factory Name
pipelineName: '<Name of Pipeline>' # My Data Factory Pipeline Name
@7effrey89
7effrey89 / app.py
Created May 21, 2025 12:02
Connect and opens a blob on ADLS Gen2 using a service principal
from azure.storage.filedatalake import DataLakeServiceClient
from azure.identity import ClientSecretCredential
# Service principal credentials
app = "<app Registration Name>" # App Registration Name
tenant_id = '<tenant_id>' # Directory (tenant) ID
client_id = '<client_id>' # Application (client) ID
client_secret = '<client_secret>' # Client secret
# Storage account name
@7effrey89
7effrey89 / app.py
Last active July 9, 2025 08:26
python - Remove embedded ocr text in pdf, and apply a new layer of ocr text using document intelligence
# Script to create searchable PDF from scan PDF or images using Azure Form Recognizer / Document Intelligence
#
# USAGE:
# python Untitled-1.py <input_file> [-o <output_file>]
#
# ARGUMENTS:
# <input_file> Path to your PDF or image file (jpg, jpeg, tif, tiff, bmp, png).
# -o <output_file> (optional) Name for the output searchable PDF.
# If omitted, output will be <input_file>.ocr.pdf
#
@7effrey89
7effrey89 / Program.cs
Created July 9, 2025 08:24
C# Azure AI Translation - Batch Translate files
using Azure;
using Azure.AI.Translation.Document;
/// <summary>
/// This program demonstrates how to use Azure's Document Translation service to translate documents
/// stored in an Azure Blob Storage container from one language to another.
/// It authenticates using a custom endpoint and resource key, then submits a translation job,
/// waits for completion, and prints the status and results for each document.
/// https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/use-rest-api-programmatically?tabs=csharp
/// https://learn.microsoft.com/en-us/dotnet/api/overview/azure/ai.translation.document-readme?view=azure-dotnet
@7effrey89
7effrey89 / Notebook.ipynb
Created September 29, 2025 15:44
Display an overview of Semantic models and their size in Microsoft Fabric
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@7effrey89
7effrey89 / notebook.py
Last active October 23, 2025 08:55
Fabric - Process all .csv in Lakehouse folder to delta tables. The .csv files are placed in a subfolder called 'input'
import os
import re
files_folder = "/lakehouse/default/Files/input"
csv_files = []
for root, dirs, files in os.walk(files_folder):
for file in files:
if file.endswith('.csv'):
csv_files.append(os.path.join(root, file))
@7effrey89
7effrey89 / Variance Analysis.ipynb
Last active October 21, 2025 12:57
Fabric - Loop through each row in table and search column values against Azure AI Search, then use AI Functions to summarize output in new column
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@7effrey89
7effrey89 / notebook.ipynb
Created October 21, 2025 13:16
Fabric - AI function demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.