Use Shelve For EFFECTIVE Persistent Data Storage In Python

preview_player
Показать описание
In this tutorial we're going to be looking at the shelve module, which is an in-built module provided by Python. It is backed by the pick module, so it allows us to store all sorts of crazy objects. Check it out!

▶ Become job-ready with Python:

▶ Follow me on Instagram:
Рекомендации по теме
Комментарии
Автор

For someone who self taught with python and has built loads of stuff using barebones knowledge, these tutorials are so amazing. Ive spent so long writing messy code wishing i knee a better cleaner method, and this guy teaches it so well

Matt-eswn
Автор

I wasn't aware of this, and think it is both elegant and useful.

Alister
Автор

Oh God. I've wasted so much time in my daily work which involves editing and loading large amounts of data. I've spent tens of minutes almost daily to reload things that could have been stored this way. Thanks a lot!

JohnSmith-nmjk
Автор

Watch it from Russia, thank you good person!!!

gtgnuro
Автор

Is it impossible to use shelve to write concurrently to a database across multiple threads? Even if I make sure that each time I write to file I use a unique key?

midlan
Автор

Does it support search like TinyDB?
Or do you have to use filters or loops to look for specific keys or values using structural pattern matching?

TheSzybas
Автор

Not sure if I want to use this in many cases. If I want to load a set I can you load the file, and I can still modify the file as a text file in some editor.

NoidoDev
Автор

Could you shelf the Fruit class itself and then retreive it ?

furrane
Автор

Under Windows, with cygwin, gdbm is available, but not under anaconda, so it seems.

Chalisque
Автор

Is the database file portable? Particularly across architectures?

DrGreenGiant
Автор

You say that pickle can only pickle one object, but you can simply call pickle.dump multiple times for unlimited number of objects. The only advantage I see for shelve is that you don't have to remember the order the multiple objects are pickled. So simply to me, shelve is like a dictionary whereas pickle is like a list.

elpiloto
Автор

i was going to make a video on this, but this is a great video. Well done...

the only question is, when would one use persistent data storage as a use case ?

darrenlefcoe
Автор

Is creating foreign keys, indices, unique constraints, multiple tables in one DB etc. possible using this library? If yes, could you make another video covering these?

wrichik_basu
Автор

Thanks for your videos. For me the key is: is it safe in a multithreading scenario?

LaCompulab
Автор

Wait, would it be possible to store a keras.Sequential this way? Just theoretically?

FidosTeasers
Автор

In what occasion it will be benefit to use shelve? Is it better using this to create a kind of database than using sqlite3 to create a database? Is it better than storing data in JSON format?

yafethtb
Автор

why your pycharm looks different its cool

Meige
Автор

hey man that intelisense type hint dropdown is sick! it clearly distinguishes between classes and methods and stuff.

id really love to install it. does anyone know what it is?

rushhour
Автор

Could this be used instead of an .ini file for a configparser?

murphygreen
Автор

We’ll now I feel like an ass inheriting UserDict and implementing this myself.

thatsunpossible