swimlane.core.resources.report module

class swimlane.core.resources.report.Report(app, raw, **kwargs)[source]

Bases: swimlane.core.resources.base.APIResource, swimlane.core.cursor.PaginatedCursor

A report class used for searching

Can be iterated over to retrieve results

Notes

Record retrieval is lazily evaluated and cached internally, adding a filter and attempting to iterate again will not respect the additional filter and will return the same set of records each time

Examples

Lazy retrieval of records with direct iteration over report

report = app.reports.build('new-report')
report.filter('field_1', 'equals', 'value')

for record in report:
    do_thing(record)

Full immediate retrieval of all records

report = app.reports.build('new-report')
report.filter('field_1', 'doesNotEqual', 'value')

records = list(report)
name

str – Report name

Keyword Arguments:
 
  • limit (int) – Max number of records to return from report/search
  • keywords (list(str)) – List of keywords to use in report/search
default_limit = 50
filter(field_name, operand, value)[source]

Adds a filter to report

Notes

All filters are currently AND’ed together

Parameters:
  • field_name (str) – Target field name to filter on
  • operand (str) – Operand used in comparison. See swimlane.core.search for options
  • value – Target value used in comparision
swimlane.core.resources.report.report_factory(app, report_name, **kwargs)[source]

Report instance factory populating boilerplate raw data

Parameters:
  • app (App) – Swimlane App instance
  • report_name (str) – Generated Report name
Keyword Args
**kwargs: Kwargs to pass to the Report class