Skip to content

Instantly share code, notes, and snippets.

@mithunkamat
Forked from jamescalam/notify_sql.py
Last active May 18, 2020 07:06
Show Gist options
  • Save mithunkamat/fb78aa3733146ab7ff98c313931b37fd to your computer and use it in GitHub Desktop.
Save mithunkamat/fb78aa3733146ab7ff98c313931b37fd to your computer and use it in GitHub Desktop.
Example usage for sending mobile notification upon completion of a data upload to MS SQL Server.
import os
import notify
from data import Sql # see https://jamescalam.github.io/pysqlplus/lib/data/sql.html
dt = Sql('database123', 'server001') # setup the connection to SQL Server
for i, file in enumerate(os.listdir('../data/new')):
dt.push_raw(f'../data/new/{file}') # push a file to SQL Server
# once the upload is complete, send a notification
# first we create the message
msg = notify.message(
subject='SQL Data Upload',
text=f'Data upload complete, {i} files uploaded.',
)
# send the message
notify.send(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment