google / google/textfsm

Feature request to support iterative parsing by reading from file objects

Open
#85 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
1.2k
Forks
194
PR merge metrics
No merged PRs in 30d

Description

The use case here is to parse an output from a command that produces 1000s of lines of output. Instead of storing all that output into a string and passing it to the parser, we'd like to send a file object and let the parser call a provided callback after completing each record. This way, the whole output need not be in memory at once. For large outputs this makes a considerable difference in memory footprint. You can see similar support in tools like lxml - https://lxml.de/api/lxml.etree.iterparse-class.html.

Typically these commands are executed remotely using some mechanism such as paramiko which offers a way to read the output from a file object (wrapping a file descriptor). So this file object can directly be passed to textfsm to perform this iterative parsing in a streaming fashion.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.