Something else to have a look at, but it might have to wait for the longer winter nights :-)

On 14/05/2019 06:20, Ben Hancock via Tutor wrote:
On Sun, May 12, 2019 at 07:17:53PM +0100, Alan Gauld via Tutor wrote:
On 12/05/2019 11:27, Dave Hill wrote:

I found out by accident that the Megger PAT 420 data backup is actually
an SQLite database, so that is my route for access. Having played with
Python on Raspberry Pi's, I thought I would explore Python for data
processing, and now, I have a set of programs which extract SQLite, to
'csv' then collate/process this data and produce a multi-page ODS
spreadsheet document, which lists tests by location. I also have an
application which extracts appliances requiring testing within a  +/- 30
day window, so I have a target for testing.

You could do it all in native SQLite SQL of course.
You can tell  sqlite to output its results in Excel
CSV format and to a file rather than (or in addition to)
stdout.

So you can write a standard query and have it generate
your Excel readable file directly.

You can then automate that as a batch job in the OS...
Assuming you run the same reports regularly.

Much as I love Python sometimes the native tools are
even better...


I wonder if `pandas` would also be a helpful library for what you're describing? It has a `pandas.read_sql` function to read data from a SQL database into a pandas dataframe, which you then can manipulate:

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_sql.html


Good luck!

--
Ben Hancock
https://elwha1.github.io
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to