FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TRABALHOSPython/Query.py at main · bellDataSc/TRABALHOSPython · GitHub
bellDataSc
/
TRABALHOSPython
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TRABALHOSPython
/
Query.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (17 loc) · 597 Bytes
Breadcrumbs
TRABALHOSPython
/
Query.py
Copy path
File metadata and controls
26 lines (17 loc) · 597 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#Puxar uma query usando Python
import
sqlite3
# Conectar ao banco de dados
conn
=
sqlite3
.
connect
(
'nome_do_banco_de_dados.db'
)
# Criar um cursor
cursor
=
conn
.
cursor
()
# Executar uma query
query
=
"SELECT * FROM nome_da_tabela"
cursor
.
execute
(
query
)
# Recuperar os resultados da query
results
=
cursor
.
fetchall
()
# Exibir os resultados
for
row
in
results
:
print
(
row
)
# Fechar a conexão com o banco de dados
conn
.
close
()
#Lembre-se de substituir 'nome_do_banco_de_dados.db' pelo nome do arquivo do seu banco de dados e 'nome_da_tabela' pelo nome da tabela que você deseja consultar.
Back
|
FazBrowse Home
|
New Git URL