3. The stingray PackageΒΆ

The stingray package implements a Schema-based File Reader. This allows us to use flat-file and workbook data from Python without having to clone an application for each physical file format or logical layout.

It also allows us to use semi-structured data like JSON, YAML or an outline. This can be handled consistently with structured data.

This package includes

  • A definition for “workbook”, “sheet” and “cell”. This can subsume csv, xlrd as well as XML parsers for XLSX and ODS files. This makes the physical format transparent to an application.
  • A definition for a schema. Not a complex XSD, but the limited, flat schema appropriate for rows in sheets of a workbook in approximately First Normal Form. This is extended to handle the simple hierarcical COBOL features.
  • Classes to load a schema that’s embedded either in a sheet or in a separate file.
  • A COBOL schema loader as an extension to the default loaders.

This depends on Python 3.3.

The structure of the stingray package is as follows.