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
1
vote
1 answer

Serialize Python object in another object with json?

how can I serialize an object which has another object in his attributes using TinyDB ? class address: def __init__(self, country, city): self.country = country self.city = city class Person: def __init__(self, name,…
Rlyeh
  • 25
  • 4
1
vote
0 answers

Query nested JSON in TinyDB

I have created a TinyDB (version 4.5.2, documentation: https://tinydb.readthedocs.io/en/latest/usage.html) database locally (macbook air, running macOS BigSur, v. 11.5.2), db.json, with a table named log, using Python 3.9.6 for the purpose of…
Gustav Rasmussen
  • 3,720
  • 4
  • 23
  • 53
1
vote
1 answer

How can I create a nested value in TinyDB using python3?

An example is this: from tinydb import TinyDB, Query from tinydb.operations import add db = TinyDB('tinydb_practice.json') db.insert({'Name':'Bella', 'Places':{}}) db.update(add('Places', {{'Country':'USA'}})) for item in db: print(item) What…
cherieodu
  • 43
  • 3
1
vote
1 answer

Add multiple tinyDB databases together

How do I add multiple tinyDB (document based database) databases together without getting a AssertionError error? I'm trying to add in this example 12 tinyDB databases together. File structure: Every numbered file looks likes this: { …
poop
  • 49
  • 6
1
vote
1 answer

Listing the Document ID from TinyDB

I am trying to list out the content of db.json from this github (https://github.com/syntaxsmurf/todo/blob/main/main.py) on line 40 in main.py Specifically this line for item in db: table.add_row( item["task"], item["completed_by"],…
1
vote
1 answer

Python tinydb - How to get specific element name?

This is what my structure looks like: {'MovieName': 'Its-a-Wonderful-Life', 'Description': 'MovieDiscription', 'IMDBID': '0038650'} I want to print out only the MovieName element. I'm using this code to get it: db =…
1
vote
1 answer

How to return JUST the key's value in TinyDB

I'm writing a script in Python 3.8.5 where the user needs to input a string, called guid in my database, and TinyDB will print back the filename value for the same upload, but I can't for the life of me figure out how to print just the filename key…
Joshua
  • 11
  • 2
1
vote
0 answers

tinydb:Empty query was evaluated

One of the things this below code does is put different student IDs in tiny database after checking if the new ID is already present or not. Code's below - #enroll.py # USAGE # python enroll.py --id S1901 --name somename --conf…
Sourabrt
  • 2,126
  • 2
  • 8
  • 22
1
vote
0 answers

How to trigger a function when date change?

I want to split my TinyDB JSONs to be one per day. I wonder if there is some function to trigger a function call once the day is changed and return to the same spot it was in the code. There is only db.insert in the code so I might want to…
Nir
  • 2,497
  • 9
  • 42
  • 71
1
vote
1 answer

Get only field values instead of documents with TinyDB

The following code returning me a list of documents that have the field text. db = TinyDB('/stream.json') Tweet = Query() db.search(Tweet.text.exists()) Instead I want to get only an array of the text field values over all the documents that have…
Nir
  • 2,497
  • 9
  • 42
  • 71
1
vote
0 answers

TinyDB search with a variable in query

I'm trying to execute a directory list and make a search by filename in a TinyDb database, like below: from tinydb import TinyDB, Query import os, fnmatch db = TinyDB('DB_links_filenames.json') User = Query() def getFieldData(campo,nome): …
Paul Mark
  • 189
  • 12
1
vote
1 answer

build search query from a dict?

let say I have dict { k1 : v1, k2 : v2 }, how do I build query from this. I can not do directly : .search( (Query().k1 == v1) & (Query().k2 == v2)) because the dict may also be : {k2:v2} OR {k1:v1, k3:v3} OR ........
sten
  • 7,028
  • 9
  • 41
  • 63
1
vote
2 answers

How to search for values in TinyDB

I would like to search my database for a value. I know you can do this for a key with db.search() but there does not seem to be any kind of similar function for searching for a value I've tried using the contains() function but I have the same…
CyK
  • 31
  • 3
1
vote
0 answers

How do I search for an entry in tinydb with the the query in json format?

I have a tinydb with entries of the form: { "key0":"value0", "key1":"value1", "key2":"value2", "key3":"value3" } and I have a function that sends me: { search:{ "key0":"value0", "key1":"value1" }, …
1
vote
0 answers

Rest api jqgrid

I have a working model of jqgrid loaded data from rest api 'get' method. I have to update the data of the grid. Can anyone help me how to post,put,delete the data through javascript.` How to write a server side code for rest api python to insert…