You are viewing a single comment's thread from:

RE: Liquidity balancer (My little Python project)

in #hive • 2 months ago

I'll keep doing my best to learn new stuff :) and hopefully one day I'll be able to code a bit more properly 😅

In some respects, I am looking at you from behind

Only if we talk about errors or questions asked to ChatGPT, otherwise I'm the only one looking from behind !LOL

Now something I'd like to start understanding a bit more are databases and how to create, manage and access them.

I know, for example, that in your script you save in a cache some info about the fetched tokens (so you don't have to fetch them again each time you run the script), and I was asking myself: can be this considered as some sort of database? And if you would like to create a more complex one, you could use something like Pandas, right? And if wont to get even more complex, this is where you should consider using SQL?

Am I getting the steps right or I'm mixing different things together? 😅

!PIZZA

Sort:  

How many jazz musicians does it take to replace a lightbulb?
A-one, a-two, a one-two-three-four!

Credit: reddit
@gamer00, I sent you an $LOLZ on behalf of arc7icwolf

(1/10)
Delegate Hive Tokens to Farm $LOLZ and earn 110% Rewards. Learn more.

Glad you asked! I’ve worked with SQL, so I’ve got some knowledge to share.

On a computer, pretty much everything is some form of a database. It can be as simple as a list object in Python, a static file on a disk (like we do with the token cache), or even a blockchain! Each of these stores data in different ways. SQL databases are more structured and designed for serving large collections of data to clients — for example, websites or accounting software. They’re like a more formal system for managing and retrieving data efficiently.

You mentioned Pandas — but since I don't personally know much of them, I had to ask ChatGPT in my own turn... and yes, Pandas seems to be a great tool for handling data in Python, especially when working with data frames (like big tables of data in memory). But it’s not quite a database in the traditional sense. It's is more of a tool for manipulating and analyzing data once it’s already loaded into your program. If you wanted to persist that data across sessions or handle really large datasets, then you’d want to consider something like SQL.

SQL databases can handle large, complex queries efficiently, and allow you to store, retrieve, update, and delete data as needed. Pandas can help you work with data in your code, but it doesn't have the persistence of a proper database unless you save it to a file.

So you’ve got the right idea! Pandas can be cool for working with data in your code, but if you need something more powerful or persistent, SQL is the next step.

!WINE

No idea how I missed your reply, sorry 😅

Luckily I came back to read again your script and, while scrolling through the comments, I noticed one I hadn't seen before!

Thanks for the answer :)

So, databases are a bit too much for me, that's for sure, but if I ever need to manage data in a persistent way, they are the right tool. Gotcha!

!PIZZA !LOL !HUG

Did you hear about the cat who ate a ball of yarn?
She had mittens.

Credit: marshmellowman
@gamer00, I sent you an $LOLZ on behalf of arc7icwolf

(2/10)
Delegate Hive Tokens to Farm $LOLZ and earn 110% Rewards. Learn more.