Created
May 15, 2020 08:17
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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