Skip to content

Instantly share code, notes, and snippets.

View ShawnMcGough's full-sized avatar

Shawn McGough ShawnMcGough

  • Lehigh Valley, PA
View GitHub Profile
@ShawnMcGough
ShawnMcGough / mssql_example_dag.py
Created April 13, 2021 18:57
A example of how to connect Airflow to SQL Server using the ODBC hook
# this is not production code. just useful for testing connectivity.
from airflow.providers.odbc.hooks.odbc import OdbcHook
from airflow import DAG
from airflow.operators.python import PythonOperator, PythonVirtualenvOperator
from airflow.utils.dates import days_ago
dag = DAG(
dag_id="mssql_example",
default_args={},
schedule_interval=None,
@ShawnMcGough
ShawnMcGough / Dockerfile
Last active April 9, 2021 22:30
A Dockerfile that extends Bitnami's docker airflow image(s) to include the bits necessary to support Microsoft SQL Server (mssql).
# set up some variables
ARG IMAGE=airflow
ARG TAG=2.0.1
ARG STAGEPATH=/tmp/mcgough
# builder stage
FROM bitnami/$IMAGE:$TAG as builder
# refresh the arg
ARG STAGEPATH
@ShawnMcGough
ShawnMcGough / AddVnetAddressSpace.ps1
Last active March 4, 2021 00:15
Drop peering, add Azure vnet IPs, restore peering
# Connect-AzAccount
# .\AddVnetAddressSpace.ps1 -IPAddressRange "10.122.16.0/21" -TargetSubscriptionName "Sub1" -ResourceGroup "networking" -TargetVnetName "vnet1"
param (
# Address Prefix range (CIDR Notation, e.g., 10.0.0.0/24 or 2607:f000:0000:00::/64)
[Parameter(Mandatory = $true)]
[String]
$IPAddressRange,
[Parameter(Mandatory = $true)]
<?xml version="1.0" encoding="utf-8"?>
<Report MustUnderstand="df" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily">
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>ff2be9e0-f921-42f0-a3f0-8862da7aaf1f</rd:ReportID>
<df:DefaultFontFamily>Segoe UI</df:DefaultFontFamily>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSource1">
<rd:SecurityType>DataBase</rd:SecurityType>
<ConnectionProperties>
<?xml version="1.0" encoding="utf-8"?>
<Report MustUnderstand="df" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily">
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>ff2be9e0-f921-42f0-a3f0-8862da7aaf1f</rd:ReportID>
<df:DefaultFontFamily>Segoe UI</df:DefaultFontFamily>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSource1">
<rd:SecurityType>DataBase</rd:SecurityType>
<ConnectionProperties>