Project: A command-line insertion utility

We can now put together the elements of database programming that we have covered in this chapter to form a robust command-line insertion utility. For this project we want to create a program with the following functionality:

  • Runs from the command-line
  • Uses a flag system allowing for the -h flag for help
  • Allows the user to define the database being used
  • Allows the user to designate which user and password combination to use
  • Allows the user to ask for the tables available in a given database
  • Provides the user with the column structure of the table on demand
  • Validates user input for the given table of the selected database
  • Builds the database INSERT statement on-the-fly
  • Inserts the user input into the chosen table ...

Get MySQL for Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.