Result class
- class querier.Result[source]
Multi value result returned by the
querier.Connectionclass.To iterate through the entries, use a python for-loop:
import querier as qr with qr.Connection(database_name, credentials_file) as con: result = con.extract(f) for entry in result: # Process entry (type: dict)
Warning
If the Connection object used to extract the Result is closed, the result object becomes invalid and will return 0 entries:
import querier as qr with qr.Connection(database_name, credentials_file) as con: result = con.extract(f) for entry in result: # Execution will never enter this loop because the Connection object was # closed by the 'with' keyword
- close()[source]
Closes the result.
The result becomes invalid and won’t return any entries when iterated.
- limit(qty)[source]
Limits the number of entries for this result.
If qty is:
<= 0, the result will return all the entries that matched the filter.
> 0, the result will return max(qty, number of entries that matched) entries
- Parameters:
qty (
int) – maximum number of entries.- Return type:
- Returns:
Result with limited number of entries.
Examples
This snippet will iterate between 0 and 100 entries (depending how many entries matched the filter):
f = qr.Filter() # Limits the extraction result to 100 entries result = con.extract(f).limit(100) for entry in result: # Process entry