Custom Airflow BashOperator for Microsoft sqlcmd
Project description
airflow-sqlcmd-operator
Custom Airflow BashOperator for the Microsoft sqlcmd.
This package utilizes the sqlcmd to run Microsoft SQLServer scripts on Linux like you would use them on SSMS for example.
The sqlcmd supports SQLServer scripts with commands like GO, USE [db_name], etc, and multiple statements.
Requirements
You must have sqlcmd already installed and (currently) on following location: "/opt/mssql-tools/bin/sqlcmd".
Installing on Ubuntu with apt:
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list
# install required packages for pyodbc
apt-get update
ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev mssql-tools && apt-get clean
Usage
On a dag, you can call it like this:
from airflow_sqlcmd_operator import SqlcmdOperator
sqlcmd = SqlcmdOperator("MyDB", "/scripts/folder/mydag", "do_stuff.sql", dag=dag)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file airflow_sqlcmd_operator-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: airflow_sqlcmd_operator-0.5.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ac011631535cbf3e39d3a0f132687e9e30fd7eef36aae5d332541816c442f5b |
|
MD5 | 9927b95b2860f4602dc8841f48be5c80 |
|
BLAKE2b-256 | b3a5a4e31051bde7d22973a1ab740d23a81fa2d8b4f51440a01a7c35432f86c7 |