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
2 answers

Get all usernames stored in TinyDB database

I'm new to TinyDB, and new to Python. I have various usernames stored in a TinyDB database, they also have other information stored (age, email addresses etc), however, I wish to return all the usernames only. {"_default": {"1": {"Username":…
rlh123
  • 13
  • 4
1
vote
1 answer

tinydb: how to update a document with a condition

Hi I would like to update some documents that match a query. So for each document I would like to update the field 'parent_id' if and only if this document have an ID greater then i.e. 6 for result in results: …
Papouche Guinslyzinho
  • 5,277
  • 14
  • 58
  • 101
1
vote
1 answer

How do i retrieve a value using TinyDB?

I've recently started coded in python and just started using TinyDB. I got the insert, remove and update working but i can't figure out how to retrieve a value from my data. {"_default": {"1": {"name": "Sarah", "value": 8}, "2": {"name": "John",…
JohnDoe
  • 23
  • 1
  • 4
1
vote
1 answer

TinyDB and Python - get last inserted row

I am using tinyDB to store some data with python, and I am trying to get the last row that I inserted to the db. so I am doing this: data = db.all() # get all data from db last_row = data[len(data) - 1] and this is how I get the last row, but it is…
TheDragoner
  • 273
  • 2
  • 6
  • 17
1
vote
4 answers

Python TinyDB Get last record in db

I am trying to get the last record from my tinyDB, so I want to make a query that looks like that: "SELECT * FROM table ORDER BY id DESC LIMIT 1" which should give me the last row. though I can't figure out how to do it with TinyDB.
TheDragoner
  • 273
  • 2
  • 6
  • 17
1
vote
1 answer

Is it possible to query nested json object using TinyDB

I have JSON file having following structure { "type":[ "apple-shimle", "king" ], "json-object":{ "test":"hi" } } How to search for test == "hi" using TinyDB python only. Iam able to fetch…
Nawap
  • 43
  • 5
1
vote
1 answer

Python: cannot read json-file with tinydb

I've got the following json-file: tag.tg [{"_type": "tag", "name": "A0", "path": "Drivers\\CMSIS\\Include\\arm_math.h", "pattern": "/^ float32_t A0; \\/**< The derived gain, A0 = Kp + Ki + Kd . *\\/$/", "typeref": "float32_t", "kind":…
K.Mulier
  • 8,069
  • 15
  • 79
  • 141
1
vote
1 answer

Redirecting all python file output to tinydb

I have a python script which consists of several threads running and they have print outs to tell any connection failure, e.g. failed to open ports, failed to connect etc. I've tried the basic: import sys sys.stdout = open('file', 'w') but nothing…
Kim SuYu
  • 69
  • 1
  • 11
1
vote
1 answer

In App Inventor, how to share a TinyDB between screens?

I added the component TinyDB1 to Screen1. Then I went to Screen2 and tried to add the same database as a component, but it's not there in the palette (left hand side screen). It's also not recognized in the call block I added I would like a common…
Steven
  • 289
  • 2
  • 5
  • 14
1
vote
1 answer

Where does 'default' come from?

i've just started using TinyDB as a way to store my data into an JSON file and this makes it easy for my to search for any content in my file. So, i've copied and pasted a code from https://pypi.python.org/pypi/tinydb and changed the names…
JasonSmith
  • 27
  • 1
  • 7
1
vote
1 answer

how to include a variable in tinydb query in python?

from tinydb import TinyDB, Query db = TinyDB('db.json') ddd = Query() kl = free output = db.search(ddd.state == 'free') How to use variable k1 in tinydb db.search?
Zeal
  • 27
  • 5
1
vote
1 answer

Fetching data interactively from TinyDB

I'm trying to figure out how to use the data a user enters as input to get information from a TinyDB DB. My DB looks something like this: {"_default": {"1": {"switch": "n9k-c9372px", "names": ["nexus 9372px", "nexus 9372-px", "nexus9372px",…
Edvard Haugland
  • 125
  • 1
  • 9
1
vote
3 answers

Storing SendBird channel list - Android

We're making an app that will have some chat functionality and we're using the SendBird Android SDK to achieve this. When the user logs in, we query SendBird for that user's GroupChannels, this returns a list of channels that the user is currently…
TheLoy
  • 183
  • 1
  • 3
  • 12
1
vote
1 answer

Unexpected behavior when using YAML Storage with TinyDB

I'm using TinyDB for a small CLI utility to manage personal document drafts. The database stores metadata for each draft; the file should be human-editable (so that I can add details manually), and for this reason I'd like to use YAML over JSON as…
fndari
  • 11
  • 3
1
vote
0 answers

Updating ArrayList from SharedPreferences (using TinyDB), using contains, but always return false

I am saving my ArrayLists to SharedPreferences in the onPause of my MainActivity. I do this as follows: TinyDB tinyDB = new TinyDB(activity); ArrayList saveUserList = new ArrayList<>(); for (User user :…
D.Blazer
  • 192
  • 1
  • 2
  • 12