Package wsatools :: Module CSV :: Class DbFile
[hide private]

Class DbFile

source code


Reads CSV files that have a header line (e.g. the output of pySQL), returning each row as a namedtuple associating column names to each value (e.g. the output of DbFile("outgest.csv").readlines() should be in the form that is identical to the output resulting from a DbSession().query() call).

Instance Methods [hide private]
file object
__init__(self, filePathName)
Reads first line of the file to define namedtuple of columns.
source code
tuple(str)
readline(self)
Converts line to namedtuple.
source code

Inherited from File: write, writelines

Inherited from Utilities.ParsedFile: next, readlines

Inherited from file: __delattr__, __enter__, __exit__, __getattribute__, __iter__, __new__, __repr__, __setattr__, close, fileno, flush, isatty, read, readinto, seek, tell, truncate, xreadlines

Inherited from object: __format__, __hash__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]

Inherited from File: autoSetDialect, setDialect

Class Variables [hide private]
  Columns = None
:type Columns: namedtuple

Inherited from File (private): _dialect

Inherited from Utilities.ParsedFile: commentMarker, stripEOLComments

Properties [hide private]

Inherited from file: closed, encoding, errors, mode, name, newlines, softspace

Inherited from object: __class__

Method Details [hide private]

__init__(self, filePathName)
(Constructor)

source code 

Reads first line of the file to define namedtuple of columns.

Returns: file object
Overrides: object.__init__

readline(self)

source code 

Converts line to namedtuple.

Returns: tuple(str)
Every value in the next line of the file.
Overrides: file.readline