Skip to content

Instantly share code, notes, and snippets.

@jamescalam
Created May 15, 2020 08:17
Show Gist options
  • Save jamescalam/63fe353eb33bcf2fd901214b66f9bef8 to your computer and use it in GitHub Desktop.
Save jamescalam/63fe353eb33bcf2fd901214b66f9bef8 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