Changelog
0.2.0
The first working release. Version 0.1 on PyPI was an empty placeholder.
Added
- Query a csv file from the command line by building the query from flags:
datapy -sa people.csv -w 'age > 40' -o name.-sselects columns,-aall of them,-wfilters,-osorts,-ggroups and-llimits. The flags work in any order. -qtakes everything fromwhereonward as one SQL string, and a whole statement can be passed as a single argument:datapy 'select name from people.csv where age > 40'.-dsets the delimiter and-Hreads files without a header line.- Works in pipelines and on files larger than memory. Queries that pick columns and filter rows are streamed in a small, fixed amount of memory and stop reading as soon as they have enough rows; queries that sort, group or count use a temporary database on disk.
- The file can be left out when input is piped in.
datapy.stream()andDataFile.stream()return rows one at a time.-t/text=keeps a column as text when it only looks numeric.-as the file name reads standard input.datapy.open()for querying a file from a script inside awithblock, anddatapy.query()for a single query.- Columns can be referenced by header name or by position (
$1,$2...). - Numeric columns are detected from the first 1,000 rows, so comparisons on them are numeric.
- Queries are read-only: only
selectstatements are accepted.
Changed
- Packaging moved from
setup.pytopyproject.toml. Python 3.10 or newer is required. There are still no runtime dependencies.