# Best way to download data from a remote URL directly into JuliaDB

**URL:** <https://discourse.julialang.org/t/best-way-to-download-data-from-a-remote-url-directly-into-juliadb/10467>\
**Category:** Performance\
**Created:** [April 21, 2018, 11:08am UTC](https://discourse.julialang.org/t/best-way-to-download-data-from-a-remote-url-directly-into-juliadb/10467 "2018-04-21T11:08:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![askvorts](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/askvorts/32/7120_2.png) [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Post date:** [April 21, 2018, 11:08am UTC](https://discourse.julialang.org/t/best-way-to-download-data-from-a-remote-url-directly-into-juliadb/10467/1 "2018-04-21T11:08:07Z")

</div>

I am trying to download a time series from a remote URL (the European Central Bank Statistical Data Warehouse) into JuliaDB. Would like to simply pass the URL to a loadtable function. I am able to load ttime-series into JuliaDB but only after downloading them using Request.get and saving them to a file. Which seems very inefficient and ugly… This is the code I have tried:

```julia
using Requests, JuliaDB
function ecb(ts::String)
    resp = Requests.get(ts)
    Requests.save(resp,"resp.csv")
    eon2=loadtable("resp.csv", skiplines_begin=5, header_exists=false, colnames=["Date","Eonia"])
    println(eon2[1])
end  
tseries = "198.EON.D.EONIA_TO.RATE"
ecb("http://sdw.ecb.europa.eu/quickviewexport.do?SERIES_KEY=$(tseries)&type=csv")
# Output: (Date = 2018-04-18, Eonia = -0.368)

```

Thank you very much

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [April 21, 2018, 12:18pm UTC](https://discourse.julialang.org/t/best-way-to-download-data-from-a-remote-url-directly-into-juliadb/10467/2 "2018-04-21T12:18:23Z")

</div>

Not sure of the syntax precisely, but I bet some combination of IterableTables and FileIO will get you there. They have a source/sink model, and I’m relatively certain any sort of bitstream can be used as the source.

---

<div class="post-metadata">

**Author:** ![askvorts](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/askvorts/32/7120_2.png) [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Post date:** [April 25, 2018, 6:19pm UTC](https://discourse.julialang.org/t/best-way-to-download-data-from-a-remote-url-directly-into-juliadb/10467/3 "2018-04-25T18:19:06Z")

</div>

To answear my own question one can do the following to load a CSV file from a remote URL into JuliaDB (example for a CSV file with two columns, skipping lines 1-5):

```julia
using HTTP, JuliaDB
function ecb2(ts)
    newtable = csvread(IOBuffer(HTTP.get(ts).body), skiplines_begin=5, header_exists=false)
    eon2 = table(newtable[1][1], newtable[1][2], names = [:Date,:Eonia])
    println(eon2[1])
end

```
