readquery (function)

readquery(sqlQuery, dbConn, log, quiet=False)[source]

Given a mysql query, read the data from the database and return the results as a list of dictionaries (database rows)

Key Arguments

  • log – the logger.

  • sqlQuery – the MySQL command to execute

  • dbConn – the db connection

  • quiet – ignore mysql warnings and errors and move on. Be careful when setting this to true - damaging errors can easily be missed. Default False.

Return

  • rows – the rows returned by the sql query

Usage

from fundamentals.mysql import readquery
rows = readquery(
    log=log,
    sqlQuery=sqlQuery,
    dbConn=dbConn,
    quiet=False
)