Antipattern: Making Bricks Without Straw
Developers commonly practice the See No Evil antipattern in two forms: first, ignoring the return values of a database API, and second, reading fragments of SQL code interspersed with application code. In both cases, developers fail to use information that is easily available to them.
Diagnoses Without Diagnostics
The following code example contains errors, but no error checking.
â | âimportâ âmysql.connectorâ |
â | |
âââ â | cnx = mysql.connector.connect(user=â'scottt'â, database=â'test'â) |
â | |
â | cursor = cnx.cursor() |
â | |
â | query = â'''SELCET bug_id, summary, date_reported FROM Bugsâ |
â | â WHERE assigned_to = ââ%ââs AND status = ââ ... |
Get SQL Antipatterns, Volume 1 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.