Giter Club home page Giter Club logo

Comments (6)

johnkerl avatar johnkerl commented on June 2, 2024 1

@aborruso that very much surprises me -- there is something I don't understand here & will need to dig into ...

from miller.

aborruso avatar aborruso commented on June 2, 2024 1

Thank you

from miller.

aborruso avatar aborruso commented on June 2, 2024

If I change the source, it works

mlr --gzin --t2c head "https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/BOP_EU6_M?format=TSV&compressed=true"

from miller.

johnkerl avatar johnkerl commented on June 2, 2024

@aborruso I believe it's because .zip and GZIP are different things

from miller.

aborruso avatar aborruso commented on June 2, 2024

@aborruso I believe it's because .zip and GZIP are different things

Ok, but for the same source, the same zip file, I can read it locally

mlr --prepipe gunzip --csv head eurofxref-hist.zip

but I have error if I read it from its URL

mlr --prepipe gunzip --csv head "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip"

Shouldn't it still read it, both locally and remotely, just like with gzip?

from miller.

johnkerl avatar johnkerl commented on June 2, 2024

@aborruso sorry for the long delay.

This was (in hindsight) obvious to me.

  • Most programs like wc and cat and gunzip et al. operate on local files -- it would be very surprising for any of them to accept https://... URLs as input. For such tools you need to do two steps: (a) copy to local, e.g. with wget, and (b) use wc, cat, gunzip, etc on the local copy.
  • Miller tries to go "above and beyond" by allowing you to read from https://... URLs

The key insight is that when you do

mlr --gzin --t2c head "https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/BOP_EU6_M?format=TSV&compressed=true"

then you are asking Miller -- which goes "above and beyond" by accepting https://... URLs as input -- to open that URL, and run the data it reads from the internet, and run that through its internal zip-decoder library. This works.

But when you do

mlr --prepipe gunzip --csv head "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip"

then you are asking Miller to do (effectively)

gunzip https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip | mlr --csv head

and of course the gunzip program does not go "above and beyond" by accepting https://... input.

So there is (unfortunately) nothing I can do about this.

A side note: why did I even invent mlr --prepipe? It's because if you have

mlr --prepipe foo --... a.csv b.csv c.csv

that's simpler than having to do

for file in a.csv b.csv c.csv; do
  foo $file | mlr --...
done

from miller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.