Read all data from CDB - database with python

Dear all

I’m trying to read data from the cdb database with python, but I don’t fully understand how it works.
This is my code, as I want to save data of each line from the database.

In my database, I see that we have 15 lines of data. How can I code that he iterates over the data until last item is reached. Or how can I get the total amount of lines, so I don’t need to check in the database to define the number of lines?

Kind regards

Instead of
for i in range(0,15)

Use
while ie < 2

Then the loop will terminate once it’s finished with the record/list

ie = see cdbase.chm, Returnvalue
= 0 → No error
= 1 → Item is longer than Data
= 2 → End of file reached
= 3 → Key does not exist