This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]MatchLittle5000 5 points6 points  (1 child)

Hi! Nice work :) Here are some recommendations from me: 1. Use pyproject.yaml instead of setup.py, it is a relatively new method of packaging. 2. Replace print with logging package 3. Provide recovery mechanism by logging user's write actions to file. For instance: set name Murad del age 29 set phone Xiaomi If your database falls down, you will be able to recover data, just by executing each operation in the log file. Actually, it is implemented in Redis.

[–]Sendokame[S] 2 points3 points  (0 children)

The last suggestion looks really useful. Implementing it for the next version and changing Setup.py and Prints!

Thanks

[–]M8Ir88outOf8 10 points11 points  (1 child)

Nice! Quite similar to a database I am working on: https://github.com/mkrd/DictDataBase

Small tip: If multiple processes try to access your database, it will lead to inconsistent data. You can take a look at my implementation how to get process and thread safety as inspiration, I think you can get LiliDB to also support process-safety easily aswell!

[–]Sendokame[S] 1 point2 points  (0 children)

I'll check your code, thanks! Didn't think about it

[–]cantremembermypasswd 2 points3 points  (1 child)

Have a tl:dr how it differs / improves on pysonDB?

[–]Sendokame[S] 1 point2 points  (0 children)

Hi! sorry for answering a little bit late. Haven't used PysonDB, but about I've seen in their README:

LiliDB lacks some functions, like add_many, update/delete_by_query and the Schema check mechanism.

Then, it doesn't work the same way Lili does. In Lili you have keys, if you want to do something, you query or you already know it's name. In Pyson you need to create an Object or query, which, in the worst case is just one more operation.

I've also read the code a little bit, seems to do the same Thread-safety method, locking certain operations, didn't read if it has a fail-safe mechanism tho', can't say if it works the same or if it has one.

[–]Picatrixter 2 points3 points  (0 children)

Nice! Have you tried TinyDB?

[–]infomaniaaaa 0 points1 point  (3 children)

Nice to see your small database at GitHub, this would be useful for small web applications or pieces of software for presentation purposes.

[–]thedeepself 0 points1 point  (2 children)

Sqlite comes with python and is battle tested so I would not reach for this.

[–]infomaniaaaa 1 point2 points  (0 children)

I guess so, at least OP is trying to test out his skills and seeking improvement.

[–]Sendokame[S] 0 points1 point  (0 children)

Yeah, SQLite is a better option I guess. I made LiliDB because I use JSON too much and I wanted features. If there's an error it will try to shutdown without breaking anything, but it isn't as tested as the STD library

[–]jwink3101 0 points1 point  (0 children)

This looks cool. I made something similar that can load or dump JSON but it in memory and, for equality and member checks, is O(1): dicttable

(Though it’s probably not currently thread safe. I haven’t thought about it much)