Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python local nosql database

# pip install tinydb

from tinydb import TinyDB, Query, where

db = TinyDB('db.json')
# insert some data
db.insert({'name': 'Leonid', 'age': 23})
db.insert({'name': 'Miro', 'age': 32})
db.insert({'name': 'Mihaela', 'age': 19})

# Two ways to query
# 1
print(db.search(where('age')> 20))

#2
Person = Query()
print(db.search(Person.name == 'Leonid'))
Comment

PREVIOUS NEXT
Code Example
Python :: python align output 
Python :: python recursion example 
Python :: python startswith 
Python :: random list generator 
Python :: recursion in python 
Python :: matlab .* operator in python 
Python :: python regex true false 
Python :: python loop to a tuple 
Python :: how to generate python code 
Python :: parse email python 
Python :: count item in list 
Python :: django prevent duplicate entries 
Python :: python destructuring 
Python :: select each two elements on a list python 
Python :: armstrong number in python 
Python :: if in python 
Python :: Tree Traversals inorder,preorder and postorder 
Python :: push button raspberry pi 
Python :: connect and disconnect event on socketio python 
Python :: change part of a text file python 
Python :: numpy.sort 
Python :: replace nan in pandas column with mode and printing it 
Python :: python any() function 
Python :: full form of api 
Python :: fibonacci sequence 
Python :: delete multiple dataframes at once in python 
Python :: Python list loop tutorial 
Python :: all function in python 
Python :: plotly express change legend labels 
Python :: celery periodic tasks 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =