First, we import the required libraries to handle argument parsing, writing spreadsheets, and interacting with SQLite databases:
from __future__ import print_functionimport argparseimport csvimport osimport sqlite3import sys
This recipe's command-line handler accepts two positional arguments, SQLITE_DATABASE and OUTPUT_CSV, which represent the file paths for the input database and the desired CSV output, respectively:
if __name__ == '__main__': # Command-line Argument Parser parser = argparse.ArgumentParser( description=__description__, epilog="Developed by {} on {}".format( ", ".join(__authors__), __date__) ) parser.add_argument("SQLITE_DATABASE", help="Input SQLite database") parser.add_argument("OUTPUT_CSV", help="Output ...