Questions tagged [tinydb]

TinyDB is document oriented database written in pure Python.

TinyDB is a query processing system for extracting information from a network of TinyOS sensors.

Unlike existing solutions for data processing in TinyOS, TinyDB does not require you to write embedded C code for sensors. Instead, TinyDB provides a simple, SQL-like interface to specify the data you want to extract, along with additional parameters, like the rate at which data should be refreshed -- much as you would pose queries against a traditional database.

http://telegraph.cs.berkeley.edu/tinydb/

98 questions
9
votes
2 answers

How to delete record or document from TinyDB

How to delete record or document from TinyDB Example of DB: {"1" : {"id_key" : "xxx", "params" : {} } }, {"2" : {"id_key" : "yyy", "params" : {} } }, I want to delete "1" if id_key=='xxx' On TinyDB tutorial code below is suggested. How to complete…
surge_
  • 133
  • 1
  • 2
  • 9
7
votes
2 answers

Match multiple keys values to database entry in TinyDB?

I am having a hard time finding out if I can check multiple key values at once with TinyDB. Currently I can check multiple fields by using and in an if statement like this: def check_table(FNAME="NULL", LNAME="NULL", MNAME="NULL"): if…
Mike - SMT
  • 14,784
  • 4
  • 35
  • 79
4
votes
1 answer

Merge Two TinyDB Databases

On Python, I'm trying to merge multiple JSON files obtained from TinyDB. I was not able to find a way to directly merge two tinydb JSON files that have keys autogenerated in the sequence that not restart with the opening of the next file. In code…
4
votes
1 answer

it is possible to input a document id on tinydb? an upsert is possible?

it is possible to define a document id when inserting a document into a TinyDB database? for example (from the tutorial) https://pypi.python.org/pypi/tinydb from tinydb import TinyDB, where from tinydb import TinyDB, where db =…
dsncode
  • 2,407
  • 2
  • 22
  • 36
3
votes
1 answer

Find objects between two dates TinyDB

I'm trying tinydb with FastAPI, but i got stuck with dates, Is there a function for finding objects between two dates in TinyDB, i couldn't find any like Pymongo's $gt etc. , i tried something like this but didn't worked out. class…
Yagiz Degirmenci
  • 16,595
  • 7
  • 65
  • 85
3
votes
1 answer

TinyDB how to update

If I want to update a specific key how would I do so? Why can't I do a direct update with dictionary methods? db = TinyDB(sys.argv[1]) #assume empty db.insert({'a':'1','b':'2'}) for record in db: if True: record['a'] =…
PhantomQuest
  • 349
  • 4
  • 12
3
votes
2 answers

How do i insert multiple tables into a table using TinyDB?

I have been trying to create multiple tables in a table using TinyDB. Here is a website to help you understand what TinyDb is (TinyDB PDF). The PDF file did not show how to insert multiple tables into one, one multiple data into one table. I…
meh
  • 53
  • 1
  • 7
3
votes
1 answer

How to retrieve a single value from a TinyDB database?

I'm learning how to use TinyDB on Python and I have the basics working (add, remove, update etc.). But now I'm trying to retrieve specific values from the database. The code I'm using is in this method: def showpassword(): show =…
RedCode
  • 363
  • 1
  • 6
  • 23
3
votes
3 answers

TinyDB get all IDs in list query

I'm using TinyDB in my python project. However, in order to make the logic effective, I need to be able to get multiple objects in a query. My preference would be to use a list listOfIDs = ['123', '456'] I am using the latest Python version and…
booky99
  • 1,436
  • 4
  • 27
  • 45
2
votes
2 answers

Cannot import name 'TinyDB'

I installed tinydb with pip. pip install tinydb I also tried it with pip3 I used the example code of tinydb to test it. from tinydb import TinyDB, Query db = TinyDB('test.json') db.insert({'int': 1, 'char': 'a'}) db.insert({'int': 1, 'char':…
Kong Konfus
  • 57
  • 1
  • 5
2
votes
3 answers

How do i import files that mutually import each other?

how do i import a function and a dictionary that mutually imports each other. These two files are already in the same directory thus, there is no nid to import sys. Also, i this it is recursive that is why it is unable to import. How do i import a…
DanielWinser
  • 151
  • 1
  • 3
  • 8
2
votes
6 answers

Parsing large csv file to tinydb takes forever

I have a large csv file containing 15 columns and approximately 1 million rows. I want to parse the data into tinyDB. The code I use is below: import csv from tinydb import TinyDB db = TinyDB('db.monitor') table = db.table('Current') i=0 datafile…
tzoukritzou
  • 337
  • 1
  • 4
  • 16
2
votes
1 answer

In Python, how do I search a TinyDB database for substrings in the values?

I made a database for a project and I want to be able to search the database for the value but better than just a simple == operation. For example, If someone types in "columbia" for the search, I want the dictionary that has "Columbia University "…
frg100
  • 139
  • 1
  • 2
  • 9
2
votes
1 answer

TinyDB insertion fails

I try to insert the JSON serialization of a Python object into tinydb. It works one time and fails after that. from tinydb import TinyDB, Query import json class Test: def __init__(self): self.test = "a" def to_JSON(self): …
ciko
  • 61
  • 1
  • 7
2
votes
2 answers

Dynamically parse and build TinyDB queries

Would it be possible to dynamically build queries in TinyDB? Its logical query operation is like this: >>> from tinydb import TinyDB, where >>> db = TinyDB('db.json') >>> # Logical AND: >>> db.search((where('int') == 1) & (where('char') ==…
AlvaPan
  • 519
  • 3
  • 12
1
2 3 4 5 6 7