[reportlab-users] Database reporting

Paul McNett p at ulmcnett.com
Mon Jun 3 09:27:11 EDT 2013


On 6/1/13 11:31 PM, Werner F. Bruhin wrote:

> I am aware of it but had the impression that it expects a Dabo bisobj


No, it's database agnostic. It just expects a sequence of mappings as a 'dataset'.


> , could I use it

> with using SQLAlchemy to access my database? I.e. feed it a SQLAlchemy query and

> access relations to get at columns?


I don't know about SA. Dabo's reportwriter wants denormalized data. So select all the
rows, columns you want out of whatever tables, and set up grouping in the report
designer.


>

> e.g.:

> result = session.query(db.Winerack)

>

> for r in result:

> print r.name

> for u in r.wineracku:

> print u.description

> for b in u.winerackb:

> print b.description, b.binno

> for i in b.winerackit:

> print i.subbinno

> if i.bottag:

> print i.bottag[0].cellarbook.drinkinfo.name

>

>

> the "for" loops would be groups and the last one would be the detail level which

> might need one or more lines. In some of the reports the "more lines" would be large

> text blob column which is the one which might need to span over multiple pages.


This case is handled well with dabo's report writer. You won't write the for loops
though, just set up the groupings in the format and provide the denormalized data.

Paul


More information about the reportlab-users mailing list