Skip to content

schema command reads the entire file for non-CSV formats #10

Description

@vgreg

Part of #5.

infer_and_export_schema documents nrows as "Number of rows to read for schema inference (default: 10000)" and says it reads only the first nrows for large files (src/daflip/services.py:679, 685). In practice nrows is only applied for CSV (services.py:709). Every other pandas-backed format falls through to _read_dataframe, which for SAS calls pd.read_sas(input_file, encoding=sas_encoding) with no row limit.

Running daflip schema on a 71 GB .sas7bdat therefore attempts to load the whole file into memory, which is both the opposite of what the docstring promises and, on a large enough file, fatal.

Fix: honour nrows for the chunk-capable formats by pulling a single chunk from a chunked reader (SAS supports this via chunksize), and for formats where a row limit is genuinely unavailable, say so rather than silently doing a full read.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions