Sql utils for retrieving energyplus tabular data

Hello!
Not sure if this is the right place for this sort of comment so if it’s not I apologise.

I was working with ladybug’s python package in order to retrieve sql data from energy plus, namely with the tabular_data_by_name function in the SQLiteResult class.

I came across a situation where the number of elements in a row of tabular_data_by_name is larger than the number of columns in tabular_column_names. After some debugging I saw that there are situations where for the same table there are multiple ReportNames -

and wanted to propose an option to filter by report name as well, either extending the function or creating a new one.
If this is something that you think might be useful i’d be happy to work on a pr for this.

thanks!
Boris

1 Like

I don’t know how to do from SQL tools; but I do interact with the HB SQLite files in ipynb via:
honeybee energy sdk:: Results
ladybug sdk: sql

Hey @BorisPlotnikov ,

Having a “ReportName” option on the method that retrieves the tabular data sounds useful and I would be happy to review a PR for honeybee-energy if you put it together. My only suggestion is that you give this new report_name option a default value of None and simply let the method work as it did previously when no report_name is specified. This way, nothing in the existing plugin will break.

thanks @TrevorFedyna, I’ll check the references.
If I do see that adding a report name is useful for my use case,
I was thinking of changing the interface of the function tabular_data_by_name

from:
def tabular_data_by_name(self, table_name, j_to_kwh=True):

to:
def tabular_data_by_name(self, table_name, j_to_kwh=True, report_name=None):

@chris, did I understand you correctly?

thanks!

Yes, if you want to add that report_name=None argument and send a PR, I would be happy to review and merge it if it looks good.

1 Like

great, thanks!
here’s a pr, will appreciate any push backs :slight_smile:

2 Likes

Thank you for the PR, @BorisPlotnikov . It generally looks good but I see that the tests are failing due to a syntax error. If you can push another commit that fixes this case, I’ll happily merge it.