List comprehensions for database requests


Version: 1.0
Category:
Scripts
Python
Requirements:
Seller:
Price:
-
System:
Rating:
4.8
License:

Description - List comprehensions for database requests



The usual way to make a request to a database is to write a String with the SQL syntax, then execute this request and get the result as a list with cursor.fetchall() or cursor.fetchone() Python has list comprehensions to select items in an iterable if a certain condition is true ; this is very Similar to database requests This recipe wraps a table of a DB-API compliant database in a class that implements the iteration protocol, so that you can use the for ... in ... if ... syntax



More in Python-List comprehensions for database requests

Cursor Syntax Database Requests Database Requests This