File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 55Using JSON as very lightweight database
66
77``` python
8- >> > db = client.create_database(' table_1' )
9- >> > db.add([{
10- ... " id" : " 1001" ,
11- ... " type" : " Regular"
12- ... }, {
8+ >> > db = Database()
9+ >> > db.load(' output.json' ) # Load database from file
10+ >> > db.add([{ # Add items what you want to add
1311... " id" : " 1002" ,
1412... " type" : " Chocolate"
1513... })
1614[' FqkmbYFSCRCAHQWydhM69v' , ' RUJGcVBFANvNRReXa8U3En' ]
17- >> > db.save(json_kwds = {' indent' : 4 })
15+ >> > db.save(' output.json ' , json_kwds = {' indent' : 4 }) # Just save it into file.
1816```
1917
2018```js
21- // table_1 .json
19+ // output .json
2220{
2321 " created_at" : " 2022-12-25T16:50:02.459068" ,
2422 " creator" : " json_as_db" ,
@@ -32,7 +30,7 @@ Using JSON as very lightweight database
3230 " type" : " Chocolate"
3331 }
3432 },
35- " updated_at" : " 2022-12-25T16 :51:36.276790" ,
33+ " updated_at" : " 2022-12-28T16 :51:36.276790" ,
3634 " version" : " 1.0.0"
3735}
3836```
You can’t perform that action at this time.
0 commit comments