PaferaPy Async 0.1
ASGI framework focused on simplicity and efficiency
|
Iterator class for database access that supports automatic chunking. More...
Public Member Functions | |
def | __bool__ (self) |
Conversion function to check if the dataset is empty. More... | |
def | __delitem__ (self, pos) |
Deletes the item from the database. More... | |
def | __getitem__ (self, pos) |
Returns the item at pos, retrieving it from the database if necessary. More... | |
def | __init__ (self, db, model, **kwargs) |
Same parameters as db.Find(), mainly because that function only sets up the parameters and lets this class do the heavy lifting. More... | |
def | __iter__ (self) |
convenience functions to allow use in iterator loops. More... | |
def | __len__ (self) |
Total number of rows for the current query. More... | |
def | __next__ (self) |
convenience functions to allow use in iterator loops. More... | |
def | __repr__ (self) |
Returns the parameters for this iterator. More... | |
def | Count (self) |
Returns the length of the underlying dataset. More... | |
def | Filter (self, cond, params) |
Resets the condition and parameters for the query used. More... | |
def | OrderBy (self, order) |
Resets the order for the query used. More... | |
def | SetRandom (self, active) |
Enables random ordering for the returned elements. More... | |
Public Attributes | |
cache | |
cachepos | |
cond | |
db | |
enablesecurity | |
fields | |
length | |
limit | |
model | |
orderby | |
params | |
pos | |
randomlist | |
randompos | |
start | |
Iterator class for database access that supports automatic chunking.
Using this class, you can examine billions of rows of data without worrying about memory usage.
Definition at line 332 of file modelbase.py.
def pafera.modelbase.DBList.__init__ | ( | self, | |
db, | |||
model, | |||
** | kwargs | ||
) |
Same parameters as db.Find(), mainly because that function only sets up the parameters and lets this class do the heavy lifting.
Definition at line 338 of file modelbase.py.
def pafera.modelbase.DBList.__bool__ | ( | self | ) |
Conversion function to check if the dataset is empty.
Definition at line 395 of file modelbase.py.
def pafera.modelbase.DBList.__delitem__ | ( | self, | |
pos | |||
) |
Deletes the item from the database.
Note that this will alter the length of the dataset.
Definition at line 484 of file modelbase.py.
def pafera.modelbase.DBList.__getitem__ | ( | self, | |
pos | |||
) |
Returns the item at pos, retrieving it from the database if necessary.
Definition at line 466 of file modelbase.py.
def pafera.modelbase.DBList.__iter__ | ( | self | ) |
convenience functions to allow use in iterator loops.
Definition at line 370 of file modelbase.py.
def pafera.modelbase.DBList.__len__ | ( | self | ) |
Total number of rows for the current query.
Definition at line 457 of file modelbase.py.
def pafera.modelbase.DBList.__next__ | ( | self | ) |
convenience functions to allow use in iterator loops.
Definition at line 377 of file modelbase.py.
def pafera.modelbase.DBList.__repr__ | ( | self | ) |
Returns the parameters for this iterator.
Handy for debugging.
Definition at line 404 of file modelbase.py.
def pafera.modelbase.DBList.Count | ( | self | ) |
Returns the length of the underlying dataset.
Definition at line 417 of file modelbase.py.
def pafera.modelbase.DBList.Filter | ( | self, | |
cond, | |||
params | |||
) |
Resets the condition and parameters for the query used.
It saves a little bit of time as opposed to creating a new object.
Definition at line 434 of file modelbase.py.
def pafera.modelbase.DBList.OrderBy | ( | self, | |
order | |||
) |
Resets the order for the query used.
It saves a little bit of time as opposed to creating a new object.
Definition at line 446 of file modelbase.py.
def pafera.modelbase.DBList.SetRandom | ( | self, | |
active | |||
) |
Enables random ordering for the returned elements.
Note that this will cause severe database activity if you use it on a dataset that won't fit in memory, so is a convenience for small datasets in local memory more than anything else.
Definition at line 546 of file modelbase.py.
pafera.modelbase.DBList.cache |
Definition at line 364 of file modelbase.py.
pafera.modelbase.DBList.cachepos |
Definition at line 363 of file modelbase.py.
pafera.modelbase.DBList.cond |
Definition at line 354 of file modelbase.py.
pafera.modelbase.DBList.db |
Definition at line 352 of file modelbase.py.
pafera.modelbase.DBList.enablesecurity |
Definition at line 367 of file modelbase.py.
pafera.modelbase.DBList.fields |
Definition at line 357 of file modelbase.py.
pafera.modelbase.DBList.length |
Definition at line 362 of file modelbase.py.
pafera.modelbase.DBList.limit |
Definition at line 359 of file modelbase.py.
pafera.modelbase.DBList.model |
Definition at line 353 of file modelbase.py.
pafera.modelbase.DBList.orderby |
Definition at line 356 of file modelbase.py.
pafera.modelbase.DBList.params |
Definition at line 355 of file modelbase.py.
pafera.modelbase.DBList.pos |
Definition at line 361 of file modelbase.py.
pafera.modelbase.DBList.randomlist |
Definition at line 365 of file modelbase.py.
pafera.modelbase.DBList.randompos |
Definition at line 360 of file modelbase.py.
pafera.modelbase.DBList.start |
Definition at line 358 of file modelbase.py.