-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLiteReadData.py
More file actions
33 lines (24 loc) · 859 Bytes
/
SQLiteReadData.py
File metadata and controls
33 lines (24 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sqlite3
from sqlite3 import Error
try:
connection = sqlite3.connect("Planalto.db")
cursor = connection.cursor()
lugares = cursor.execute("SELECT * FROM locais")
lugares.fetchall()
for row in cursor.execute("SELECT * FROM locais"):
print(row)
# print(f"""
# Lugares da tabela 'locais':
# ID: {lugares.id}, Local: {lugares.local}
# """)
eventos = cursor.execute("SELECT * FROM eventos")
eventos.fetchall()
for row in cursor.execute("SELECT * FROM eventos"):
print(row)
# print(f"""
# Compromissos da tabela 'eventos':
# ID: {eventos.id}, Coleta: {eventos.coleta}, Datahora: {eventos.datahora}, Dia da semana: {eventos.diadasemana}, Compromisso: {eventos.compromisso}
# """)
connection.close()
except Error as exc:
print("SQLite error:", exc)