项目作者: PhoeniXkrypT

项目描述 :
Helper functions for using pymysql
高级语言: Python
项目地址: git://github.com/PhoeniXkrypT/DbUtils.git
创建时间: 2017-08-20T13:11:56Z
项目社区:https://github.com/PhoeniXkrypT/DbUtils

开源协议:

下载


DBUTILS

Some functions useful when working with a database, implemented in python.

Set the environment variables

  • DB_HOST=’localhost’ e.g. export DB_HOST='localhost'
  • DB_USERNAME=’username’
  • DB_PASSWORD=’password’

Example usage

  1. d = DbManager(host=os.environ['DB_HOST'],
  2. user=os.environ['DB_USERNAME'],
  3. password=os.environ['DB_PASSWORD'])
  4. d.create_db(<database_name>)
  5. d.use_db(<database_name>)
  6. d.create_table(<table_name>, (<column_description>))
  7. d.insert_table_data(<table_name>, [<column_values>])
  8. d.delete_db(<database_name>)
  9. d.close()