HOME/Articles/

mysql example retorna logs (snippet)

Article Outline

Python mysql example 'retorna logs'

Modules used in program:

  • import config.mysql as dbconfig

python retorna logs

Python mysql example: retorna logs

import config.mysql as dbconfig
from MysqlFactory import MysqlFactory

connection = MysqlFactory().getConnection(dbconfig.params)
cursor = connection.cursor()

query = """
        SELECT 
            *
        FROM
            log
        WHERE
            log.id_course is null
"""

cursor.execute(query)

result_set = cursor.fetchall();

print(cursor.rowcount)
connection.close();