FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python_reference/sqlite3/query_db.py at master · wavelets/python_reference · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
wavelets
/
python_reference
Public
forked from
rasbt/python_reference
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python_reference
/
sqlite3
/
query_db.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (21 loc) · 758 Bytes
Breadcrumbs
python_reference
/
sqlite3
/
query_db.py
Copy path
File metadata and controls
28 lines (21 loc) · 758 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
27
# 10/28/2013 Sebastian Raschka
# Syntax basics for querying sqlite3 data bases
import
sqlite3
# open existing database
conn
=
sqlite3
.
connect
(
'zinc_db1.db'
)
c
=
conn
.
cursor
()
# print all lines ordered by number of non_rot_bonds
for
row
in
c
.
execute
(
'SELECT * FROM zinc_db1 ORDER BY non_rot_bonds'
):
print
row
# print all lines that are purchasable and have <= 7 rotatable bonds
t
=
(
'YES'
,
7
,)
for
row
in
c
.
execute
(
'SELECT * FROM zinc_db1 WHERE purchasable=? AND non_rot_bonds <= ?'
,
t
):
print
row
# print all lines that are purchasable and have <= 7 rotatable bonds
t
=
(
'YES'
,
7
,)
c
.
execute
(
'SELECT * FROM zinc_db1 WHERE purchasable=? AND non_rot_bonds <= ?'
,
t
)
rows
=
c
.
fetchall
()
for
r
in
rows
:
print
r
# close connection
conn
.
close
()
Back
|
FazBrowse Home
|
New Git URL