You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the persistence of the data in a database file is not persistent at all, but all in-memory.
Background
I have created a new Store object with a filename parameter. The database file is created. The code uses a custom class that extends minidb.Model. The data is held in the custom Model class that I created and I can call .save(...) and .load(...) with the correct results outputted to me.
However, when I try to view the data in the database in a 3rd party app. Nothing shows up in the db table!
I tried to only .save(...) the results to the databases in one run-session, and then .load(...) the persisted data in another run-session. However, no data was loaded in my program at all.
Code
This code works and displays the contents of the "database" to the console; however, nothing appears in the database file.
class AndroidStudioRelease(minidb.Model):
date = str
name = str
category = str
release_type = str
filename = str
location = str
sha256 = str
filetype = str
platform = str
...
db = minidb.Store('android-studio-downloads')
db.register(AndroidStudioRelease)
...
release = AndroidStudioRelease(date=date, name=name, category=category, release_type=release_type, filename=filename, location=download_location, sha256=sha256, filetype=filetype, platform=platform)
release.save(db)
...
for release in AndroidStudioRelease.load(db, (AndroidStudioRelease.c.platform == "Linux") & (AndroidStudioRelease.c.category == "Preview")):
print(release)
The text was updated successfully, but these errors were encountered:
Thank you for the quick reply. I was going off of the documentation from the git README file. That didn't state anything about committing or closing. I ended up calling db.close() at the very end and now I can see my data persist in the database!!
It appears even example.py doesn't use commit or close, and I didn't find anything in the documentation about needing those two methods. Did I miss it somewhere?
Good point. Mostly that's because the example by default uses an in-memory database, so no persistence is necessary. I've added a paragraph describing db.close() and db.commit() to the part where the example talks about saving to a file.
Summary
It appears that the persistence of the data in a database file is not persistent at all, but all in-memory.
Background
I have created a new
Store
object with a filename parameter. The database file is created. The code uses a custom class that extendsminidb.Model
. The data is held in the custom Model class that I created and I can call.save(...)
and.load(...)
with the correct results outputted to me.However, when I try to view the data in the database in a 3rd party app. Nothing shows up in the db table!
I tried to only
.save(...)
the results to the databases in one run-session, and then.load(...)
the persisted data in another run-session. However, no data was loaded in my program at all.Code
This code works and displays the contents of the "database" to the console; however, nothing appears in the database file.
The text was updated successfully, but these errors were encountered: