×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Python
Posted by: Pavel Evtikhov
Added: Apr 11, 2022 7:09 AM
Modified: Apr 11, 2022 12:03 PM
Views: 237
Tags: no tags
  1. import sqlite3
  2.  
  3. with sqlite3.connect('temp.db') as connection:
  4.     # маппинг - добавляем название столбцов в выдаче
  5.     connection.row_factory = sqlite3.Row
  6.     cursor = connection.cursor()
  7.     query = """
  8.  
  9.    """
  10.     cursor.execute(query)
  11.  
  12.     while True:
  13.             line = cursor.fetchone()
  14.             if not line:
  15.                 break
  16.             print(dict(line))