Skip to content

White-Owl/nisql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nisql

NISQL (short for Non Interactive SQL) is a tool designed to be used in a scheduled environment. It allows user to connect through ODBC to any database, execute any SQL script, and dump the resultset or multiple resultsets into the file(s).

The NISQL is written in OS and RDBMS independent way, so it can be used in any environment.

The intended way to use nisql is to put it in a shell script like this:

#!/bin/sh

today=`date +%F`
csvfile="/tmp/daily_report_for_$today.csv"

nisql DSN=MyDB daily_report.sql $csvfile -f"HDR=yes"

mail [email protected] --attach=$csvfile -s"Daily report for $today" <<EOT
Dear Boss,
Here is an automated report for $today
EOT

This assumes that MyDB is a DSN to connect to the database. And daily_report.sql contains a SQL statement (or multiple statements) which are resulted in a single resultset. Just put this script to the cron and done.

About

Non Interactive SQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages