FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plotdevice-libs/database/database_test.py at master · plotdevice/plotdevice-libs · GitHub
plotdevice
plotdevice-libs
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
plotdevice-libs
/
database
/
database_test.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (23 loc) · 776 Bytes
Breadcrumbs
plotdevice-libs
/
database
/
database_test.py
Copy path
File metadata and controls
32 lines (23 loc) · 776 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
28
29
30
31
32
import
importlib
try
:
db
=
ximport
(
"database"
)
except
:
db
=
ximport
(
"__init__"
)
importlib
.
reload
(
db
)
book
=
db
.
create
(
"book"
)
book
.
create_table
(
"pages"
, [
"title"
,
"description"
,
"pagenumber"
])
book
.
pages
.
append
(
title
=
"introduction"
,
pagenumber
=
1
)
book
.
pages
.
append
(
title
=
"chapter one"
,
pagenumber
=
2
)
book
.
pages
.
append
({
"title"
:
"chapter two"
,
"pagenumber"
:
3
})
print
(
"Tables created"
,
book
.
tables
())
print
(
"All pages:"
,
book
.
pages
.
all
())
print
(
book
[
"pages"
])
print
(
"Page 1:"
,
book
.
pages
.
pagenumber
(
"1"
))
print
(
"Chapter two:"
,
book
.
pages
.
find
(
"*two"
,
key
=
"title"
))
book
.
pages
.
remove
(
1
)
book
[
"pages"
].
remove
(
2
)
print
(
"Remaining pages:"
,
book
.
sql
(
"select * from pages"
))
book
.
pages
.
edit
(
3
,
pagenumber
=
"appendix"
)
book
.
commit
()
print
(
book
.
dump
())
book
.
close
()
Back
|
FazBrowse Home
|
New Git URL